Bolca kullanığımız AJAX requestleri (post) için aşağıdaki kod parçası hayatınızı kolaylaştıracaktır. Mootools “Request” fonksiyonu kullanılmaktadır. Daha sonraki yazılarda bu fonksiyonu ASP.NET ile nasıl kullanabileceğimizi göreceğiz.
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);
};
Kullanımı :
Sensei.send("service/serviceurl.ashx","doIt","cId=5&bId=5",0, function(result){
alert(result);
});
Recent Comments