小编moi*_*ran的帖子

Jquery ajaxrequest xhr.status代码0但是html状态代码200

这不是一个跨站点请求问题,因为我的问题的大多数Google搜索答案都包含在内.

当我尝试用jquery函数.get和.load创建一个ajax请求时,我得到xhr.status 0 och xhr.statusText"error".但是在Firebug中,请求的页面加载了html状态代码200,我可以读取响应中的文本,响应头看起来不错.

我的代码:

  function GetProjectTask(e) {
    var loader = $('#' + e + 'tasks div.loader');
    var content = $('#' + e + 'tasks div.content');
    var img = $('#' + e + 'tasks img.collapseimg');
    if (loader.html() == null || loader.html().trim() == '') {
        if (content.html() == null || content.html() == '') {
            img.attr('src', 'images/expanded.gif');
            loader.html('<img src="images/loading.gif" alt="Wait..."> Loading support tasks');
            content.load('includes/my' + e + 'tasks.php',
                function (response, status, xhr) {
                    if (status == "error") {
                        var msg = …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery http-status-code-200

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

ajax ×1

http-status-code-200 ×1

javascript ×1

jquery ×1