This is probably a stupid mistake, but I'm using jQuery ajax for a PHP server, and I would like the PHP script to publish the progress on a web page.
It seems to be working fine, but I cannot get the contents of e.target.responseText.
If I do console.log (e.target), I get the XMLHttpRequest object in the console. And I see responseText: "1 av 1500 linjer"
But if I do console.log (e.target.responseText), it is empty.
Am I lost my mind?
This is my function:
$.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); }
});
Data in the console:
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
source
share