I\'ve been observing some strange behavior with the following code:
$.fn.submit_to_remote = function() {
// I use .each instead of the .submit directly so
Keep in mind that the jQuery submit() event looks for:
<input type="submit">, <input type="image">, or <button type="submit">
in the form (http://api.jquery.com/submit/). Some frameworks default the type attribute to "submit", so if you are trying to override the default, change the type attribute to something else so it doesn't submit multiple times.
Not sure about this strange behavior, but seems that unbinding the submit event will do the trick.
So, before running the script returned by the $.ajax call, run this:
$('.submit_to_remote').unbind("submit");
That should remove previous bindings and leave just the new one.