I'm stuck in part of my code for calling the php function in Jquery. Here is my code:
var remaining_amount= parseFloat(total_amount) - parseFloat(selected_amount);// returns something like 120
$('.remaining_amount').html('<?php echo display_money('remaining_amount')?>');// here I need to pass it in to my custom PHP function to show the amount with currency.
But the problem is that the function display_money
taking the variable value as string (remaining_amount
) and creating the problem to produce the desired result. some thing like (120$).
Updated:
Here is the full code that show how I'm using the remaining_amount
, It is changing on the base of selected value.
//show the remaining amount
$("#selected_amount").live("change", function(event){
var total_amount=$('#ta').html();
var selected_amount=$(this).val();
if(selected_amount=="")
{
$('.remaining_amount_row').hide();
$('.final_withdraw').hide();
return false;
}
else
{
var remaining_amount= parseFloat(total_amount) - parseFloat(selected_amount);
$('.remaining_amount').html(remaining_amount);
$('.remaining_amount_row').show();
$('.final_withdraw').show();
return false;
}
});