I have Ajax function with a callback which fetches all the Patient data however I have some perfomance issues and trying to figure out what it might be, does anyone have idea? That's my Code
var patient = new Array();
function sync(arg, callback){ //ajax result
$('.loader').show();
$.ajax({
method: 'GET',
url: 'sync/active.php',
dataType: 'json',
data: arg, // argument schicken und aktualisieren
success: function(data, status, xhr){
$('.loader').hide();
callback(data);
// setTimeout(sync, ajaxDelay);
},
error: function(xhr, ajaxOptions, thrownError){
console.log(thrownError);
}
});
}
function onPatientCallback(data) {
var res = data;
for(var i=0; i<res.length;i++){
for(var key in res[i]){
var value = res[i][key];
switch(key){
case "id":
res[i][key] = parseInt(value);
break;
case "kundennr":
res[i][key] = parseInt(value);
break;
case "client":
res[i][key] = value;
break;
case "start":
res[i][key] = new Date(value);
break;
case "end":
res[i][key] = new Date(value);
break;
case "title":
res[i][key] = value;
break;
case "description":
res[i][key] = value;
break;
case "termart":
res[i][key] = parseInt(value);
break;
case "userId":
res[i][key] = parseInt(value);
break;
default:
console.log("unbekannter Datentyp "+key);
}
}
}
patient = res;
}
I use the function to fill the patient variable and call it in another js file like that sync({calling: "patient"}, onPatientCallback);
snyc()
andonPatientCallback()
are called, and 2. possible HTML corresponding to this code? \$\endgroup\$