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

jqm 怎么传值?

  •  
  •   colorsand · 2015-06-08 23:03:24 +08:00 · 2517 次点击
    这是一个创建于 3243 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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