i have 2 pages, index.html
and about.html
index.html
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
... load jquery and jquery mobile...
</head>
<body>
<div data-role="page" id="index">
...content goes here...
<a href="about.html?id=1" data-role="button">about</a>
</div>
</body>
</html>
and about.html
has just the page data-role
<div data-role="page" id="about">
...content goes here...
</div>
the problem is that when i click on the link to go to the about
page and i try to get the url string, well, it shows me index.html
window.location.toString();
or
$.mobile.activePage.data('url');
both return index.html
instead of about.html?id=1
i understand that the about.html
gets loaded into the index page, but how to grab that id??
any ideas?
thanks
ChangePage
method needs to be used to send parameters from one page to another:
$(document).on('pagebeforeshow', '#index' ,function () {
var parameters = $(this).data("url").split("?")[1];;
parameter = parameters.replace("parameter=","");
alert(parameter);
});
If you want to find out more take a look at this ARTICLE , to make it transparent it is my personal blog. Or it can be find HERE . Look for a chapter called: Data/Parameters manipulation between page transitions
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.