且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 Jquery 在页面加载时触发表单提交

更新时间:2022-12-17 13:12:34

如果你调用 $().submit() 它会触发动作;$().submit(function) 将处理程序绑定到提交事件.

if you call $().submit() it triggers the action; $().submit(function) binds a handler to the submit event.

不过你可以跳过提交,直接调用ajax方法.

You can skip the submit however and just call the ajax method directly.

$(function() {
  $.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();});  

      }  
  });
});