php - Adding exactly 100 values to database using ajax -


O people, 3:36 AM and I need to be mentally promoted.

Simple question, is the easiest / quickest way to add 100 points to a database, please assume that everyone will not work due to write, duplicate, poor data etc.

I am trying to update the database with value 100.

Once I have a good piece of data, I have to add it to the database and I will use the function called updateDB.

This function just writes a latitude / LNG coordination for the database. If there is a duplicate or write fails, then I send "error" from php and the loop must continue to continue collecting data, unless I have 100 points from the database. This function that I am using

CCT is used for XSAS prevention, please ignore it, it works fine.

  //// More than this (100-completed & gt; transmitted) ++; UpdateDB (LAT, LNG); /// more junk and then this function functionDB (lat, lng) {var cct = $ ("input [name = csrf_mysite]"). Val (); $ Ajax ({type: "post", url: "/ form", data: {'lat': lat, 'lng': lng, 'id_set': id_set, 'csrf_complexity': cct}, success: work (results) {Var obj = jQuery.parseJSON (result); if (obj.status === "OK") {full ++; var marker = new google.maps.marker ({icon: marker sign, status: new google $ ("#progressbar") .program ("option", {value: full, maximum: 100}); $ ("# zodiac"). Text ("get image" full + 100 ");}}, Error: work (data) {//alert (data.responseText);}, complete: function (data) {if (full == 100) window.location = "/ start / karte"; sent -;}}); }   

If this function does not work then why any idea?

It should work only Call Update DD until it reaches 100 joint value and Only updates calls when there is no possibility that additional calls will be made. Dispatch does not cease properly so I am fully handling every event is not called.

Thoughts or actions like this Any other way would be horrible.

Write your server side script to react with a figure - then you send 100 data points in the first request:

  browser server | | | --- & gt; 100 data --- & gt; | | & Lt; - send more 20 & lt; - | | | | --- & gt; 20 data --- & gt; | | & Lt; - Send 1 more & lt; - | | | | --- & gt; 1 data --- & gt; | | & Lt; - Send more & lt; - | | | Vv   

This way you do not get the problem of synchronization that comes from the count when the client is finished, how much information has been processed on the server - server data processing Is not included, duplicates, ill created etc., and the server is needed.

All the customers have to do this so that everyone has to send and voting for how much is necessary for the server. In addition, you want to send several points once due to the overheads of an Ajax request, but you do not really want to send more than anything, because it is also useless.

Hope it helps

Comments