Counting clicks changing link href
I asked this question but did not explain it thoroughly. I have a regular
link:
<a href="http://www.google.com">Click Me</a>
I want the change the href after the link is clicked 10 times not by the
individual use but clicked 10 total times by all users.My jquery is
obviously flawed but here is what i have:
var count = 0;
$(document).ready(function(){
$('a').click(function(){
count++;
if(count > 10){
$('a').attr("href","https://www.yahoo.com");
}
});
});
I am new to jQuery but from what ive read cookies and local storage store
individual users information not the total websites information. So how
could i use ajax with a database to do this? maybe even php?
No comments:
Post a Comment