在jquery mobile中获取url值?

use*_*279 2 url mobile jquery

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

HTTP://localhost/testing/nothing.html#details ID = 0&颜色=蓝色的?

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

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

});

谢谢.

Nul*_*ter 6

请检查链接

写下如下所示的功能

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

}

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

    $.urlParam('id'); 
Run Code Online (Sandbox Code Playgroud)