我面临着非常奇怪的问题。我写了django项目,其中我发送了ajax请求。如果响应在1分钟之前到来,则ajax工作正常,但如果响应不在1分钟内,则ajax返回错误&#34 ;无法加载资源:net :: ERR_EMPTY_RESPONSE"。
我的ajax代码如下:
$.ajax({
url: '/index/',
type: 'POST',
timeout: 60000000,
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(finalJson),
dataType: 'text',
success: function(response){
// Get response from django server
// do your code here
off();
console.log("Got response");
console.log(response);
if(response.includes("documents will be deleted"))
{
console.log("response!!!");
if (confirm(response + '.Continue' + '?'))
{
document.getElementById("overlay").style.display = "block";
document.getElementById("loader").style.display = "block";
console.log("yes");
$.ajax({
url: '/index/',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify({"logpaths":jsonobj,"emails":mailobj,"cu_hostname":cu_host,"user_tag":us_tag,"delete_s_date":delete_s_date,"delete_e_date":delete_e_date,"delete_docs":true}),
dataType: 'text',
success: function(response)
{
off();
alert(response);
}
});
}
}
else
{
alert(response);
}
//document.getElementById("response_div").innerHTML = response;
}
});
请帮帮我。