I have this Jquery code and i need to add the var data and a number together…
$('div[name=price]').html("");
$.post("getprice.php", { unit: $('input[name=property]:checked').val() , date: $('#car').val() + $('#smh').val() } ,function(data){
$('div[name=price]').html(data + 1);
$('#bprice').val(data);
});
But data equals 499 but it just displays as 4991 when it should say 500
Thanks
Lee
You have two options, since Javascript is defaulting to treating it as a string:
EDIT: I’m not sure I picked the right field you were talking about, but the idea is you have to convert a string to a numbers, and that is done by
parseIntor multiplying by 1