在jQuery Mobile中获取URL值? [英] getting url values in jquery mobile?

查看:63
本文介绍了在jQuery Mobile中获取URL值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jquery mobile来获取附加在url中的值.

i am trying to get the value attached in the url using jquery mobile.

http://localhost/testing/nothing.html#details? id = 0& color = blue

当我转到详细信息"页面时,我想使用jquery mobile获取id = 0和color = blue:

I want to get the id = 0 and color = blue using jquery mobile when i go to the "details" page:

$('#details').live('pagecreate',function(event) {

$('#details').live('pagecreate',function(event) {

});

谢谢.

推荐答案

请检查链接

写出如下所示的功能

$.urlParam = function(name){
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
return results[1] || 0;

}

要获取特定值,只需调用函数并传递参数名称

To get a particular value just call the function and pass the name of the parameter

    $.urlParam('id'); 

这篇关于在jQuery Mobile中获取URL值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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