2012-07-30 57 views
0

我需要在原型中編寫這個jquery函數。我如何轉換它?表單提交原型

submitHandler: function(form) {            
    $.post("post.php?"+$("#form1").serialize(), {  
     }, function(response){               

      if(response==0) 
       {              
        alert("security code is wrong!"); 
        return false; 
       }             
      } 
    ); 

},

回答

1

嘗試:

new Ajax.Request('post.php?' + $('form1').serialize(), { 
    onSuccess: function (transport) { 
    var response = transport.responseText; 

    if (response == 0) {              
     alert("security code is wrong!"); 
     return false; 
    } 
    } 
});