Sunday, 6 September 2009

Jquery making synchronous call

These days I am completely concentrating on JQuery, I want to share the knowledge I am gaining with you. In this post, I want to tell you how can we make synchronous calls. Everyone knows all the ajax calls are asynchronous. Whatever we are making calls in Jquery to server through clientproxy are the asynchronous calls. So, how to make synchronous calls? That is why I am posting here.

$.ajax({
type: "POST",
url: "url of the page",
processData: false,
success: function(msg) {alert("success")},
async:false
});

If you see the last line, the attribute declaration async:false which is the key for the telling the Jquery client proxy to make asynchronous call or not. If it is true then asynchronous otherwise synchronous.
Hope this helps you to understand it well.

No comments:

Post a Comment