JQuery – Utilities

Posted: June 4, 2010 in JQuery
Tags:

JQuery AJAX request (Synchronous)

$.ajax({
type: ‘GET’,
url: URL + String.format(‘?action={0}’, ‘GET’),
success: function(result, status) {
LoadData(result);},
async:   false
});

If you want to maintain more time gap before calling success handler then you can have timer delay …

$.ajax({
type: ‘GET’,
url: URL + String.format(‘?action={0}’, ‘GET’),
success: setTimeout(function(result, status) {
LoadData(result);}, 500),
async:   false
});

JQuery AJAX call is very simple compared to below Javascript AJAX call

MS ATLAS way –

var r = new Sys.Net.WebRequest();
r.set_url(URL + String.format(‘action={0}’, ‘GET’));
r.set_httpVerb(‘GET’);
r.add_completed(function(executer, args) {
if (executer.get_responseAvailable()){
var result = executer.get_responseData();
LoadData(result);
}
});
r.invoke();

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s