Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 永久更新Elementor/Wordpress中的html元素_Javascript_Php_Wordpress - Fatal编程技术网

Javascript 永久更新Elementor/Wordpress中的html元素

Javascript 永久更新Elementor/Wordpress中的html元素,javascript,php,wordpress,Javascript,Php,Wordpress,我希望在成功页面上更新一个号码,并永久更改该号码,以便新访问者获得更新的号码。该网站是在Wordpress中建立的。带有localStorage的路由将不起作用,因为更新后的号码对新访问者不可见 你有一个永久更新ID元素的解决方案吗?我需要使用PHP函数吗 window.addEventListener('load', function () { let signUpCounter = document.querySelector("#sign-up-counter"); if (signU

我希望在成功页面上更新一个号码,并永久更改该号码,以便新访问者获得更新的号码。该网站是在Wordpress中建立的。带有localStorage的路由将不起作用,因为更新后的号码对新访问者不可见

你有一个永久更新ID元素的解决方案吗?我需要使用PHP函数吗

window.addEventListener('load', function () {

let signUpCounter = document.querySelector("#sign-up-counter");

if (signUpCounter) {
function countUpByOne(start, end) {
    var current = start;
    setInterval(function () {
        // current += 1;
        current++;
        signUpCounter.innerHTML = current;
        if (current == end) {
            current = start;
        }
    }, 10000);
}
}

countUpByOne(7000, 15000);

});

非常感谢你的帮助

存储在DB中(可能在选项表中,带有
add_options
)并从中获取它。@Harpreethingh是的,但您将如何确切地做到这一点:/类似这样的事情。。在递增计数器的成功页面上,使用
update_选项('increment',$counter)
然后在要显示它的页面上。。使用
get_选项(“增量”)
存储在DB中(可以在选项表中,带有
add_options
)并从中获取它。@HarpreetSIngh是的,但您将如何确切地做到这一点:/类似于这样的东西。。在递增计数器的成功页面上,使用
update_选项('increment',$counter)
然后在要显示它的页面上。。使用
get_选项(“增量”)