Easy javascript AJAX with Mootools

28 Mar
2009

We most used Ajax requests the following snippet of code will make your life easier. Mootools “Request” function is used in this code. The next article in this function we’ll see how ASP.NET.

Sensei = {};
Sensei.Send = function(URL, fName, prms, retryCount, OnComplete) {
	if (retryCount == null) retryCount = 0;
	var jsonRequest = new Request(
		{
                'encoding' : 'utf-8',
		method: 'post',
		url: URL,
		onComplete:  OnComplete,
		onFailure: function(){
					if(retryCount<3)
						Sensei.Send(URL, fName, prms, OnComplete, retryCount++);
		},
       }).send('m=' + fName + '&' + prms);
};

How to use :

Sensei.send("service/serviceurl.ashx","doIt","cId=5&bId=5",0, function(result){
      alert(result);
});
Be Sociable, Share!

1 Response to Easy javascript AJAX with Mootools

Avatar

Anonymous

August 14th, 2012 at 00:31

[…] […]

Comment Form

You must be logged in to post a comment.

top