异步提交表单
提示:这里可以添加技术概要
核心源码
`
// 定义函数命名空间
Kevin = new Object();
/**
- 异步提交表单
*/
Kevin.submitAjaxForm=function(formId, url, succback, isunlock){
jQuery.ajax({
url: url, // 提交的页面
data: $(“#” + formId).serialize(), // 从表单中获取数据
type: “POST”, // 设置请求类型为"POST",默认为"GET"
dataType: “json”,
contentType: “application/x-www-form-urlencoded;charset=UTF-8”, // 必须要设置为UTF-8,否则提交数据乱码
beforeSend: function(){
if(!isunlock){
new screenClass().lock();
}
},
error: function(msg) { // 设置表单提交出错
new screenClass().unlock();
alert(“执行出错:” + msg.responseText);
},
success: function(resp) {
if(!isunlock){
new screenClass().unlock(); // 设置表单提交完成使用方法
}