javascript - jquery ajax send data double to php -
I counted a normal JavaScript and at the end of the countdown, an AJAX request should save the database to the database.
It works fine but it saves entrance twice, why does it save double but any suggestions? (Sorry for my English I'm German)
var countdown = <= 0) {// Funktion document.getElementById ("counter"). InnerHTML = "N & amp; aum; chste Kampagne wird geladen"; Var datastring = {ip: & lt ;? Php echo json_encode ($ ip)? & Gt;, uid: & lt ;? Php echo json_encode ($ uid)? & Gt;, tone: & lt ;? Php echo json_encode ($ tan)? & Gt ;; Reload: & lt ;? Php Echo Jason_Ancode ($ reloaded)? & Gt;, Verdinest: & lt ;? Php Echo Jason_ AND ($ Vertient)? & Gt;, Priis: & lt ;? Php Echo Jason_Adid ($ Priest)? & Gt; }; $ .ajax ({type: 'post', url: 'http://xxxxxxxxxxx.de/xxxxxxxxxx/xxxxxxxxxx.php', data: dataseting, // success: function (data) {// $ ('# results' ). Html (data); //}}); } And {document.getElementById ("counter"). InnerHTML = Countdown; }} If (Countdown = 0) {setTimeout ("count ()", 1000); }} Calculation ();
Kind regards
change this:
if (countdown> = 0) {setTimeout ("count ()", 1000); }
with this:
if (countdown> gt; {setTimeout ("count ()", 1000); }
Comments
Post a Comment