Search code examples
jqueryformsajaxform

form object inside of ajaxForm error callback


I'm trying to access my form object inside of ajaxForm's error method:

$('#foo').ajaxForm({
  error: function(){
    // where's my $('#foo') object?
  }
});

error can take 3 params, but none of them are the form object, also this returns the url, but again no form.

Any suggestions?


Solution

  • Tricky, why not use:

    var myForm = $("#foo");
    
    myForm.ajaxForm({
     error: function(){
      myForm.//whatever
     }
    });
    

    If there is another way, I'd love to know myself.