views:

22

answers:

0

hi i am using mootools ajax request in my project. its works properly but when i make request for it aborted first time and second time request mad. consequently abortion of request increase by one at each click. my code is following

    function addStepConfiguration(id,mystrip,comment,error,submitid) {
    // alert(id+'\n'+mystrip+'\n'+comment+'\n'+error+'\n'+submitid.value);
    $(id).addEvent('submit', function(e) {
      e.stop();
      this.set('send', { 
       onRequest:function(html){
        $(submitid).setStyle('display','none');
        loading_Img();
       },
       onComplete: function(responseText) { 
        $('loading_img').innerHTML = '';
       SplittedResText = responseText.split("|");
      s  //alert(SplittedResText);
        if(SplittedResText[1]=='undefined') {
         $(error).innerHTML=SplittedResText[0];
         $(submitid).setStyle('display','block');
        } else {
         $(comment).innerHTML=SplittedResText[0];
         $(mystrip).set('class',SplittedResText[1]);
         //$(image).setProperty('src',SplittedResText[2]);
         removeMsg.delay(20,'',error);
         removeMsg.delay(3000,'',comment);
         $(submitid).setStyle('display','block');
        }
       }
      });
      this

.send();
 });
}