I am loading a data using jQuery load method. It works fine. Now I want to multiple it with 2. eg If i have 1000 I want to multiple it with 2 so that it will become 2000. It works fine only when I include alert in my code. If i remove alert, it returns 1000.
here is my code
$('#<%= qnty.ClientID %>').click(function () {
var desID = $('#<%= designID.ClientID %>').val();
var qnty = $('#<%= qnty.ClientID %>').val();
$("#amountHave").load("AmountRetrieve.aspx?desID=" + desID + "&qnty=" + qnty + " #amountHaveRet");
if ($("#reverseDes").is(":checked") || $("#plain").is(":checked")) {
var slash = ".00/-";
var getAmnt = $("#amountHave").text();
getAmnt = getAmnt.replace(slash, '');
var finamAmount = parseInt(getAmnt, 10) + parseInt(getAmnt, 10);
//IF I USE ALERT HERE IT WORKS
//alert(finamAmount)
$("#amountHave").text(finamAmount + slash);
}
else {
$("#blackholder").text("-------- Rs. " + $("#<%= qnty.ClientID %>").val());
$("#matchholder").text("-------- Rs. " + $("#<%= qnty.ClientID %>").val());
}
});
Any help would be highly appreciated.
You forgot your callback:
$("#amountHave").load("AmountRetrieve.aspx?desID=" + desID + "&qnty=" + qnty + " #amountHaveRet", function(){
if ($("#reverseDes").is(":checked") || $("#plain").is(":checked")) {
var slash = ".00/-";
var getAmnt = $("#amountHave").text();
getAmnt = getAmnt.replace(slash, '');
var finamAmount = parseInt(getAmnt, 10) + parseInt(getAmnt, 10);
$("#amountHave").text(finamAmount + slash);
}
else {
$("#blackholder").text("-------- Rs. " + $("#<%= qnty.ClientID %>").val());
$("#matchholder").text("-------- Rs. " + $("#<%= qnty.ClientID %>").val());
}
});