error: function (jqXHR, exception) {
var msg = '';
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.'+ jqXHR.responseText;
}}
$out = curl_exec($obCurl);
$info = curl_getinfo($obCurl);
javascript функция которая с помощью ajax начитает слать запросы по API на внешний сервис в цикле, когда этих запросов не больше 30
$.ajax({
type: "POST",
url: "ajax.php",
data: {
days: days,
mydb: mydb
},
beforeSend: function () { // Before we send the request, remove the .hidden class from the spinner and default to inline-block.
$('#loader').removeClass('hidden')
},
cache: false,
success: function (responce) {
// alert("success");
$('div[id="Show'+what_to_show+Campaing_id+'"]').html(responce);
},
timeout: 1000000,
error: function (jqXHR, exception) {
var msg = '';
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.'+ jqXHR.responseText;
} else if (jqXHR.status == 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
alert(msg);
$('#post').html(msg);
},
complete: function (responce) { // Set our complete callback, adding the .hidden class and hiding the spinner.
$('#loader').addClass('hidden')
}
});
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.'+ jqXHR.responseText;
}
echo(" ");flush();