To submit a form to load the page, you should write something like
$(function() { $('#seller-agreement-form').submit(); });
But if what you are trying to do is simply perform the same action that you would otherwise have performed when submitting the form, then you might not want to submit the form, but only for this:
function postForm() { $.ajax({ type: "POST", url: "http://www2.myurl.com/formhandler", data: "email="+ email + "&status=" + status, success: function(){ $('form#seller-agreement-form').hide(function(){$('div#output').fadeIn();}); } }); } $("form#seller-agreement-form").submit(function() { postForm(); return false; }); $(function() { postForm(); });
source share