jeudi 1 septembre 2016

Database is not responding until all requests are submitted successfully: MySQL

I am using Laravel 5.3 for Web API and below is my JQuery Ajax request which saves records concurrently. Below is the code..

for (i = 0; i < 100; i++) {
    var 
     data={'Role' : "Role"+i},
     request = $.ajax({
        url:                'http://localhost:1234/Practise/public/api/SaveRoleApi',
        type:               "POST",
        data:               JSON.stringify(data),
        contentType:        "application/json; charset=utf-8",
        async:  true,
        success: function(d){ console.log(d); }
     });
}

I am using for loop to save 100 records. Please check there is async: true,. Reason I said it is saving records concurrently because the requests are being submitted randomly although I confirmed that all requests are being submitted successfully.

My Question is: I can't submit select statement select * from tblrole until all the above ajax requests are submitted.

Problem is: Database is not responding until all requests has been submitted.

What should I do to retrieve records during the Post request(s) submission is in progress?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire