在链接href之后更改其被点击的总数 [英] changing a link href after total number it is clicked on

查看:132
本文介绍了在链接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>

我想在链接被点击10次后更改href,而不是个人使用,但点击10所有用户的总时间。我的jquery显然有缺陷,但这里是我有:

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");
}
});
});

我是新的jQuery,但从什么读取cookie和本地存储存储个人用户信息不是总网站信息我可能是错误的,但我appriciate的帮助

I am new to jQuery but from what ive read cookies and local storage store individual users information not the total websites information i could be wrong but i appriciate the help

推荐答案

Jquery是一种客户端脚本语言。所以你不能跟踪所有用户点击只用jquery。所以你必须使用一些服务器端语言与数据库。因此,当用户点击链接时,您可以发送它,并在ajax请求的数据库表中添加一个标志。

Jquery is a client side scripting language. So you cant track all users clicks only with jquery. So you have to use some server side language with a database. So when a user clicked on the link you can send it and add a flag in a database table with an ajax request.

这篇关于在链接href之后更改其被点击的总数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆