i using laravel 5.3 web api , below jquery ajax request saves records concurrently. below code..
for (i = 0; < 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 using loop save 100 records. please check there async: true,
. reason said saving records concurrently because requests being submitted randomly although confirmed requests being submitted successfully.
my question is: can't submit select statement select * tblrole
until above ajax requests submitted.
problem is: database not responding until requests has been submitted.
what should retrieve records during post request(s) submission in progress?
below phpmyadmin details.
perhaps confusion...
async
has getting response, not on submitting in parallel.
the code presented single-threaded -- submit 1 request, submit request, ..., don't wait them finish.
then, after 100 submits, perform select
.
i guess ajax chokes on many submissions , gets stalled.
Comments
Post a Comment