Hi I written the ajax call inside if(confirm…. condition but it is not going to my ajax page. If i write $.get outside of if(confirm(…. then it is working fine.
What is the problem. please tell me some one.
function ConfirmSave() {
if (confirm("Do You Want to Save the test?"))
{
$.get('../Common/Ajax.aspx',{action:"UpdateExamDuration",UserExamMapID:UserExamMap});
}
document.location.href = "../Reports/Report-Card.aspx";
}
Ignoring the trailing brace
}(probably just left that in there, right?) it worked for me, in that the ajax request was fired. I saw this because I had persist mode on in FireBug (meaning that request was still visible after I was redirected with the last line). What you want to do is put thedocument.location.hrefinside the$.getcallback, meaning it will only run once it has completed: