использовать
$.ajax( ...params... )
.then(
function(data, textStatus, jqXHR) {
alert("Success: " + data);
// initiate next sequential operation
},
function(jqXHR, textStatus, errorThrown) {
alert("Error: " + errorThrown);
// initiate next sequential operation
});
Ответ
function requestT(t){
$.ajax({
url:t,
method:"GET",
async: true,
xhrFields: {
withCredentials: true
}
}).then(function(data,textstatus,xhr) {
//your code....
},
function(xhr,text,error){
var x = prompt("do you want to continue if YES enter 1?");
if(x == 1){
console.log("reload Request...");
requestT(t);
}
}
);//ajax
}//func request