[英]Debugging jQuery ajax 500 Internal server error
我工作的CodeIgniter站点在MediaTemple上托管它时会出现500内部服务器错误。 它发生在jQuery Ajax调用期间。
我不知道会出现什么问题。 来自控制器或型号的错误? 我的Ajax电话:
$.ajax({
url: "<?php echo site_url('invites/save_email') ?>",
type: 'POST',
data: form_data,
success: function(msg) {
window.location.href = "<?php echo site_url('invites/moreinvites')?>"
return true;
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
alert(xhr.responseText);
}
});
xhr.responseText已经退回给我<p>The action you have requested is not allowed.</p>
。 但是,这是什么意思?
您可以尝试使用alert(xhr.responseText);
或console.log(xhr.responseText);
(后面会在您的浏览器控制台中显示,例如firebug)在您的错误回调中,这样做可以获得与异常相关的消息(如果有的话)。
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(xhr.responseText);
alert(thrownError);
}
要么
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status);
console.log(xhr.responseText);
console.log(thrownError);
}
请在这里查看我的回复。 这是关于如何使用CodeIgniter和jQuery进行ajax调试的完整说明。
您需要配置webconfig文件以接收POST请求。
<system.web>
<webServices>
<protocols>
<add name="HttpPost" />
</protocols>
</webServices>
</system.web>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.