V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
colorsand
V2EX  ›  jQuery

jqm 怎么传值?

  •  
  •   colorsand · 2015 年 6 月 8 日 · 3006 次点击
    这是一个创建于 3893 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我有一个页面里边是链接的列表比如<a href="index.php?id=1#post">,当点击这个链接的时候,我怎么在新的页面获取到到id=1,然后去服务器请求内容。

    8 条回复    2015-06-09 14:19:56 +08:00
    airyland
        1
    airyland  
       2015 年 6 月 9 日
    在新的页面从location.href取得id。
    Wangxf
        2
    Wangxf  
       2015 年 6 月 9 日 via iPhone
    location.href获得,然后split之类的去做处理取到
    Septembers
        3
    Septembers  
       2015 年 6 月 9 日
    > location.search
    < "?id=1"
    > location.search.slice(1)
    < "id=1"
    colorsand
        4
    colorsand  
    OP
       2015 年 6 月 9 日
    @airyland 新页面里边的url变成了index.php?#post,没有id=1
    des
        5
    des  
       2015 年 6 月 9 日
    不知道题主想说什么?我试了是可以的
    http://img-storage.qiniudn.com/15-6-9/15170212.jpg
    airyland
        6
    airyland  
       2015 年 6 月 9 日
    @colorsand 额,你问题描述相当不准确。
    gilgamesh
        7
    gilgamesh  
       2015 年 6 月 9 日 via Android
    你不想跳转的话就别用 a(href) 呗。
    colorsand
        8
    colorsand  
    OP
       2015 年 6 月 9 日
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1034 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 19:22 · PVG 03:22 · LAX 11:22 · JFK 14:22
    ♥ Do have faith in what you're doing.