php - how to get the response from an ajax request with application/x-octet-stream? -
i using jsonp content api.
the issue link have returns file saved csv , response application/x-octet-stream.
if in chrome developer tools error resource interpreted script transferred mime type application/x-octet-stream:... , uncaught syntaxerror: unexpected identifier.
but, if in preview or response tabs can see data.
is there way grab data?
one solution me setup different headers in php, entire page break
any ideas?
thanks
try this-
function main() { var xhr; xhr = new xmlhttprequest(); xhr.open("get", "foo.csv?r=" + math.random(), true); xhr.onreadystatechange = function() { if (xhr.readystate === 4) { //xhr.responsetext stores csv content document.queryselector("body").innerhtml = xhr.responsetext; } }; xhr.send(null); }
Comments
Post a Comment