javascript - Jquery modification to add 1 and save the number in a txt file on every click -


i using following click function purpose. can add add 1 in txt file when clicked? counter on how many times clicked.

thank you

$("#clearme").click(function(e) {     e.preventdefault();     // have stuff here }); 

you can't access or edit files front-end. you'll need php or something. can save in variable , pass , process ajax. this, untested:

var num = 0; $button.click(function(){     $.ajax({         url: 'bla.php',         type: 'post',         data: { num: ++num }         //...     }); }); 

and in php:

$num = $_post['num']; // add file stuff 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -