Possible Duplicate:
How do I Convert a String into an Integer in JavaScript?
i have the following code:
$.ajax({
type: "GET",
url: 'index.php?act=ajax&op=getShippingPrice&id='+shippingID,
success: function(data) {
var currentPrice = Number($("#finalPrice").html());
var newPrice = Number(currentPrice + data);
$("#finalPrice").html(newPrice);
}
});
i try to calculate the new price. but i actually get a string of newPrice, which contains the current price, and right after it the data from ajax.
if the current price is 1500, and data from ajax is 10, what i get is 150010, and not 1510.
i also tried to use parseInt, probably didn't use it right.