调试jQuery ajax 500内部服务器错误

Him*_*dav 10 ajax jquery

我工作的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);
    }
});
Run Code Online (Sandbox Code Playgroud)

xhr.responseText已经归还了我<p>The action you have requested is not allowed.</p>.但是,这是什么意思?

Sni*_*ivs 42

您可以尝试在错误回调中使用alert(xhr.responseText);console.log(xhr.responseText);(稍后将在浏览器控制台中显示,例如firebug),这样做可以获得与异常相关的消息(如果有的话).

error: function (xhr, ajaxOptions, thrownError) {
           alert(xhr.status);
           alert(xhr.responseText);
           alert(thrownError);
       }
Run Code Online (Sandbox Code Playgroud)

要么

error: function (xhr, ajaxOptions, thrownError) {
           console.log(xhr.status);
           console.log(xhr.responseText);
           console.log(thrownError);
       }
Run Code Online (Sandbox Code Playgroud)