jQuery load()的问题 [英] problems with jquery load()

查看:62
本文介绍了jQuery load()的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要每3秒刷新页面上的某个div.该div中还包含其他div.

I need a certain div refreshed on the page every 3 seconds. This div contains other divs inside it.

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
setInterval(function()
{
    $('#gamewrapper2').load('find.php #gamewrapper2');
}, 3000);
;

此代码有效,但仅当访问的页面是domain/find.php且不适用于domain/find.php?id = 1000001

This code works but only if the page visited is domain/find.php and it doesn't work for domain/find.php?id=1000001

也许我听不懂,但是这个功能加载不应该把find.php中的#gamewrapper2块粘贴到当前页面的#gamewrapper2块中吗?

Maybe i don't understand something but shouldn't this function load take the block #gamewrapper2 from find.php and paste it into the block #gamewrapper2 of the current page?

推荐答案

是否只需要将查询字符串保留在find.php上?像这样:

Do you just need to keep the query string on find.php? Something like:


    setInterval(function(){
        $('#gamewrapper2').load(window.location.pathname + window.location.search + ' #gamewrapper2');
    }, 3000);

这篇关于jQuery load()的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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