I already made a counter in JavaScript. Really basic... just increasing the value of an variable.
What I am looking for now is a way to store this on my FTP server. I want to count the clicks of a button. onClick=""
And I also just want to show it in a tag that gets the value of the text file.
The problem is that I have no idea how to code this and witch language I should use. I can use all web based languages.
you can make an ajax call to a server side php script which can store clicks in a text file. Then get contents of that text file in same script and send back the response to ajax script which should update the concerned element on HTML page.
P.S. : I am no supporter for php, it's just next to my natural language to me :)
Using jQuery:
$('#button').click(function()
{
$('#result').load("pathtophpfile.php");
});
And then create a PHP File that basically looks into the file and increments it's value:
<?php
$clicks = file_get_contents("clicks.txt");
$clicks++;
$fp = fopen("clicks.txt", "w+");
fwrite($fp, $clicks);
fclose($fp);
//debug
echo "result: $clicks";
?>
Here's a quick fiddle: http://jsfiddle.net/4QhL8/1/