Not sure how to do ajax functions inside of javascript to get to mysql -


im not quite sure how go putting ajax function inside of javascript timer everytime restarts itll add 1 of item database. ive been looking , found this: http://www.tizag.com/ajaxtutorial/ajax-mysql-database.php im not quite sure how implement code, if me itd appreciated.

heres code far:

<head> <script type="text/javascript"> var c=10; var minecount = 0; var t; var timer_is_on=0;  function timedcount() { document.getelementbyid('txt').value = c; c = c - 1; if (c <= -1) { minecount++; var _message = "you have mined " + minecount + " iron ore" + (((minecount > 1) ? "s" : "") + "!"); document.getelementbyid('message').innerhtml = _message; startover(); } }  function startover() {  c = 10; cleartimeout(t); timer_is_on=0; domining(); } function domining() { if (!timer_is_on) {     timer_is_on = true;     t = setinterval(function () {         timedcount();     }, 1000);                 } }  </script>   <span style="float:left"> <form> <input type="button" value="mining" onclick="domining()"> <input type="text" id="txt"> </form> </span> <html> <center> <div id='message'></div> 

try including jquery , put $.post('path/to/file.php', {param1: value1}); in domining() function


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -