这可能是一个愚蠢的错误,但我正在使用JQuery ajax来对付PHP后端,我希望PHP脚本将进度发布回网页 .

它看起来工作正常,但我无法获得e.target.responseText的内容 .

如果我执行console.log(e.target),我会在控制台中获取XMLHttpRequest对象 . 我可以看到responseText:“1 av 1500 linjer”

但是,如果我执行console.log(e.target.responseText),它就是空的 .

我迷失了吗?

这是我的功能:

$.ajax(

{

type: "POST",

url: "modEcs/ajax/ecs.php?a=analyseExcel",

processData: false,

contentType: false,

xhrFields:

{

onprogress: function(e)

{

console.log(e.target);

console.log(e.target.responseText);

}

},

success: function(data)

{

},

error: function (xhr, ajaxOptions, thrownError) { alert(xhr.statusText); }

});

控制台中的数据:

XMLHttpRequest

onabort: null

onerror: null

onload: null

onloadend: null

onloadstart: null

onprogress: function(e)

onreadystatechange: null

ontimeout: null

readyState: 4

response: "1 av 1500 linjer"

responseText: "1 av 1500 linjer"

responseType: ""

responseURL: "xxx"

responseXML: null

status: 200

statusText: "OK"

timeout: 0

upload: XMLHttpRequestUpload {onloadstart: null, onprogress: null, onabort: null, onerror: null, onload: null, …}

withCredentials: false

XMLHttpRequest-prototype

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐