当用户在IE8中提交my时,无论是否具有兼容模式,表单都会执行AJAX调用,但不会发送POST数据。下面是我的jQuery.validate和jQuery.form代码:
var v = jQuery("#enterfrm").validate({
submitHandler: function(form) {
jQuery(form).ajaxSubmit({
target: "#result",
success: function() {
$("#enterfrm").hide();
}
});
},
debug: true,
rules: {
reportto: {
required: true
},
jobtitle: {
required: true
},
dept: {
required: true
},
paystatus: {
required: true
},
reason: {
required: true
},
prefstartdate: {
required: true
},
sthour: {
required: true
},
edhour: {
required: true
},
jbdescex: {
required: true
},
positionchg: {
required: true
},
minexp: {
required: true
},
adrecreq: {
required: true
},
comsug: {
required: false
},
org: {
required: true
},
origemail: {
required: true
},
// //
replacing: {
required: function(element) {
return $("#reason").val() == "Replacement";
}
},
replacetitle: {
required: function(element) {
return $("#reason").val() == "Replacement";
}
},
justify: {
required: function(element) {
return $("#reason").val() == "New Position";
}
},
length: {
required: function(element) {
return $("#paystatus").val() == "Temporary - In House" || $("#paystatus").val() == "Temporary - Outside";
}
},
purpose: {
required: function(element) {
return $("#jbdescex").val() == "No" || $("#positionchg").val() == "Yes";
}
},
duties: {
required: function(element) {
return $("#jbdescex").val() == "No" || $("#positionchg").val() == "Yes";
}
},
sthour: {
required: true,
minlength: 4,
maxlength: 8
//notEqTime: true
},
edhour: {
required: true,
minlength: 4,
maxlength: 8 //,
//notEqTime: true
}
}
});
以下是FireBug Lite捕获的内容:
ResponseHeaders
Date Mon, 17 Jan 2011 13:56:25 GMT
Server Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.12 with Suhosin-Patch mod_perl/2.0.2 Perl/v5.8.8
X-Powered-By PHP/5.2.4-2ubuntu5.12
Keep-Alive timeout=15, max=100
Connection Keep-Alive
Transfer-Encoding chunked
Content-Type text/html
RequestHeaders
Content-Type application/x-www-form-urlencoded
X-Requested-With XMLHttpRequest
Accept */*
POST选项卡下没有任何内容。这一切在Firefox,Chrome和IE浏览器中都能很好地运行。就问题而言,我是否遗漏了一些东西?
修改 我现在也尝试使用GET请求,这也不起作用。
答案 0 :(得分:0)
看起来像jQuery.Form使用$.param(a)
来序列化表单,我只是成功地让IE用$.param(a, true)
创建正确的POST数据。请参阅此处。 http://api.jquery.com/jQuery.param/
您可以通过$.ajaxSettings.traditional = true;