samedi 17 juin 2017

jQuery currency convert on checkbox click using google finance api

I want my amount field to get updated with the converted value of the total amount (with amount I mean the sum of amount received from all checkboxes checked). For example, I have the following checkboxes.

<input type="checkbox" value="10">
<input type="checkbox" value="20">
<input type="checkbox" value="30">

These 10, 20 and 30 (total 60) values are in USD. I want it to be converted to INR and be displayed in a div like say <div class="convertedAmount">Rs.0.00</div>. For conversion I am using Google Finance API here as shown below.

<?php
$from_Currency = "USD";
$to_Currency = "INR";
$encode_amount = 1;
$get = file_get_contents("http://ift.tt/2tyoWlq");
$get = explode("<span class=bld>",$get);
$get = explode("</span>",$get[1]);
$converted_currency = preg_replace("/[^0-9\.]/", null, $get[0]);
echo $converted_currency;
?>

Now the problem is that I want the div value to be updated each time when checkboxes are checked or unchecked using jquery. But I have weak hands on jQuery so I am having trouble. I would be grateful if helped. Please help me.




Aucun commentaire:

Enregistrer un commentaire