Try this…
You can use jquery ajax to pass values to php page and get output from ajax success.
$.ajax({
type: "POST",
url: "ajax.php",
data: {from:from,to:to},
success: function(data){
alert(data);
//you can get output form ajax.php, what you expected.
}
});
ajax.php
<?php
$from = $_POST['from'];
$to = $_POST['to'];
$url="http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s=". $from . $to .'=X';
$handle = @fopen($url, 'r');
if ($handle) {
$result = fgets($handle, 4096);
fclose($handle);
}
$allData = explode(',',$result);
$dollarValue = $allData[1];
echo 'Value of $1 in Indian Rupees is Rs. '.$dollarValue;
solved php to javaScript