I'm updating thousands of rows in my database, I would like to know which is faster to use that will not overload my server,
I have here an ajax request that retrieves thousands of json data,
under the success: function(response){}
i have another ajax request that will update each record.
Just take a look at my code,
should i execute it one by one? or should i pass it as a whole?
$.ajax({
url: '', /* API Url of JSON Data from Hosts */
type: 'GET',
dataType: 'json',
xhrFields: {
withCredentials: true
},
success: function(response){
for(i=0; i < response.length; i++)
{
$.ajax({
url: '/api/update_record',
type: 'GET',
dataType: 'json',
data: { 'sample_data': response[i] },
success: function(response){
console.log(response);
}
});
}
}
});
Thank You,