douju7765 2015-11-09 07:34
浏览 25

使用GET方法不会传输值

Whenever I write echo $_GET['sec']; then it shows the value of sec but when I try the following code:

    $(document).ready(function() {
        setInterval(function () {
            $('#div_id').load('../data.php?id_to=<?php $_GET['sec'];?>')
        }, 100);
    });

The value of "sec", which is coming from another page does not transfer to data.php with id_to variable.

What's wrong with my code?

I can see the value of $_GET['sec']; in current page but the value is not available on the data.php file.

  • 写回答

2条回答 默认 最新

  • dty63504 2015-11-09 07:44
    关注

    Code is okay so variable if available should be passed

    So what can you try is:

    You have simple mistake you don't echo

    change <?php $_GET['sec'];?> to <?php echo $_GET['sec'];?> or <?= $_GET['sec'] ?>

    also:

    1. what's the output of this php code is it ile '../data.php?id_to=VALUE' If output is okay then variable will be passed via GET method

    2. In your data.php try doing echo $_GET['id_to'] maybe you try to output sec and this causes problem?

    3. You can always try print_r($_GET); on data.php

    评论

报告相同问题?

悬赏问题

  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸
  • ¥15 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢