jQuery、ajax 405 方法不允许
我有一个带有 jQuery 验证、PHP 和 ajax 的小型“联系表单”。我的网站在 IIS 上运行。
问题是,我尝试使用 ajax + jQuery 发布表单内容,但我得到了响应 例如“405 Method Not allowed”(来自 firebug 控制台)。
但它在本地服务器上运行正常。请帮我修复 405 错误。提前致谢。
以下是提交表单时的 JavaScript 代码:
$("#contactusForm").validate({
rules: {
firstName: {
required: true
},
email: {
required: true
},
},
messages: {
firstName: {
required: " *Required"
},
email: {
required: " *Required"
},
},
submitHandler: function (form) {
var dataString = 'firstName=' + firstName + '&email=' + email;
$.ajax({
type: "POST",
url: "send_contact.php",
data: dataString,
success: function () {
$('#result').html("<br/><b>Thank you</b>");
}
});
}
});
I have a small "contact form" with jQuery validation, PHP and ajax. My website running on IIS.
The problem is, I am trying to post the form contents using ajax + jQuery, but I am getting the response
like "405 Method Not Allowed" (From firebug console).
But its running properly in local server. Pls help me to fix 405 error. Thanks in advance.
Here's the JavaScript code while submitting the form:
$("#contactusForm").validate({
rules: {
firstName: {
required: true
},
email: {
required: true
},
},
messages: {
firstName: {
required: " *Required"
},
email: {
required: " *Required"
},
},
submitHandler: function (form) {
var dataString = 'firstName=' + firstName + '&email=' + email;
$.ajax({
type: "POST",
url: "send_contact.php",
data: dataString,
success: function () {
$('#result').html("<br/><b>Thank you</b>");
}
});
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论