加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ajax提交整个form表单

发布时间:2020-12-15 21:40:05 所属栏目:百科 来源:网络整理
导读:在项目开发中,有时提交form表单时不能单单用action或者jquery的 /prepre style="list-style: none; padding: 0px; outline: 0px; border: currentColor; color: rgb(51,"Courier New",245);" class=" JScript" name="code" 表单提交方法有三种,主要说下第

在项目开发中,有时提交form表单时不能单单用action或者jquery的

</pre><pre style="list-style: none; padding: 0px; outline: 0px; border: currentColor; color: rgb(51,"Courier New",245);" class=" JScript" name="code">
表单提交方法有三种,主要说下第三种
第一种:用form自带属性<span style="color: rgb(255,0);"><strong>action</strong></span>提交
第二种:用jquery提交:<span style="line-height: 1.4285; background-color: rgb(240,240,240);"><strong><span style="color: rgb(255,0);">$("#formid").submit();</span></strong></span>
<span style="line-height: 1.4285; background-color: rgb(240,240);">第三种:用ajax提交:</span>
</pre>

举例如下:

$.ajax({
	cache: true,type: "POST",url:ajaxCallUrl,<span style="color: rgb(255,0);"><strong>data:$('#yourformid').serialize(),</strong></span>// 你的formid
	async: false,error: function(request) {
		alert("Connection error");
	},success: function(data) {
		$("#commonLayout_appcreshi").parent().html(data);
	}
});

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读