doulang6013 2013-07-19 08:57
浏览 42
已采纳

一种从URL获取参数的方法

I have this issue i'm trying to solve.

I have this page lista.php In which i load another page (which refreshes every x seconds) named pagination.php

I use this script:

function LoadContent()
{
    $('#lista').load('pagination.php');
}
$(document).ready(function(){
    LoadContent(); //load contentent when page loads
    setInterval('LoadContent()',30000); //schedule refresh
});

Well, there is this URL:

lista.php?id=3

I need the pagination.php to grab the id, but it won't work.. the pagination.php is inside lista.php... how can i solve it? I tried the GET method..

Any suggestion please? Thanks.

  • 写回答

4条回答 默认 最新

  • dongshiliao7990 2013-07-19 09:05
    关注

    Add the parameter to the url, e.g.:

    function LoadContent()
    {
        var id = ... <== assign id here
        $('#lista').load('pagination.php?id=' + id);
    }
    $(document).ready(function(){
        LoadContent(); //load contentent when page loads
        setInterval('LoadContent()',30000); //schedule refresh
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)