Reputation: 181
I would like to send a request like:
$.ajax({
type: "POST",
url: url,
data: data,
success: function(data) {
console.log(data);
var file = new Blob([data], {
type: 'application/zip'
});
var fileURL = URL.createObjectURL(file);
window.open(fileURL);
},
error: function(xmlhttprequest, textstatus, message) {
if (textstatus === "timeout") {
alert("got timeout");
} else {
alert(textstatus);
}
},
timeout: 10000
});
But the timeout isn't enough. I have an error in Java server:
Try to write on a closed channel[keepAlive:true]: Remote host may have closed the connection
Is there a way to make a query that keeps the connection open until the answer?
Thanks
Upvotes: 1
Views: 621
Reputation: 2505
set timeout to 0 for unlimited, by default it is 0, but some browsers have their own timeouts. I hope you also are aware that timeout is in milliseconds, so you're only waiting for 10 seconds, may be try increasing it to some 60 seconds (60000), if timeout: 0
isn't working
Upvotes: 1