I wanna do something like this, but this one looks like happing for infinite times.
$("form").live("submit", function() {
if($(this).attr('action') != "ajax"){
$(this).submit();
return true; // even i do this!! but form is NOT submited!!
}
else { /* doing the ajax stuff! */ }
});
in Chrome and Firefox after a while the form gets submitted, something like 10seconds and in IE it crashes !
I know when i say form.submit means that i am submitting this and get called function again and again, how can i avoid this ?
By fring
.submit()again, which bubbles back to the.live()handler, you’re causing an infinite loop, instead you want to call the nativeform.submit()method here, like this:Also
.actionis a native DOM property, you can access it that way…not need for the jQuery overhead here.