Search code examples
jqueryprototypejsdom-events

Form submit in prototype


I need to write this jQuery function in prototype. How can I convert it?

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

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

},


Solution

  • Try:

    new Ajax.Request('post.php?' + $('form1').serialize(), {
      onSuccess: function (transport) {
        var response = transport.responseText;
    
        if (response == 0) {                                                      
          alert("security code is wrong!");
          return false;
        } 
      }
    });