來源:http://blog.csdn.net/tolcf/article/details/41151195
在項目開發中,有時提交form表單時不能只使用action或者jQuery的
表單提交方法有三種,主要說下第三種
第一種:用 form 自帶屬性action 提交
第二種:用 jquery 提交:$("#formid").submit();
第三種:用 ajax 提交:
但如果form表單中數據很多時,不可能一一列出,只需要用
$('#yourformid').serialize()就可以了
舉例如下:
$.ajax({ cache: true, type: "POST", url: ajaxCallUrl, data: $('#yourformid').serialize(),// 你的formid async: false, error: function(request) { alert("Connection error"); }, success: function(data) { $("#commonLayout_appcreshi").parent().html(data);\ } });