> $(function() { > var _options = { > target: $( this ), > beforeSubmit: function(data, set, options) { > alert( $(set).attr( 'action' ) ); > } > } > $( '.form' ).ajaxForm( _options ); > }); > > > I've also tried using just the 'this' keyword. Anyway, when I use this > it freezes the browser... My goal is to make the response target > wrapper the same form that I'm submitting (basically a refresh of the > newly updated form). I can't just leave the form as is due to some > extra bits of JS that aren't form elements that will be reset when the > response is loaded. > > Am I specifying my target incorrectly for what I want to achieve? > > PS: I've changed my target to the specificy form using an id and also > I set the target to $( '.form' ) which posts the response in ALL of my > forms, so I know that it is working, just not with the 'this' keyword > for some reason.
'this' does not equal the form where you are using it. Most likely 'this' is the document at that point. Try this instead: $(function() { var _options = { beforeSubmit: function(data, $form, options) { options.target = $form; } }; $( '.form' ).ajaxForm( _options ); });