开发者

URL data passing and JQuery Effect

I have the following code in my web app

<li><a href="javascript:this.next('A')">A</a></li> 

And the javascript function 'next' creates and loads the following link when the above item is clicked:

.../testing.php?first=A#result

It works fine, It calls the 'result' anchor, and I extract the value of 'first' via: 开发者_运维百科

$first=$_GET['first'];

but the problem is, I am using JQuery Mobile and the sliding effect that usually happens between anchor switches doesnt work. It simply loads another page.

I tested out a bunch of different ways of passing the data through the URL, and it seems the slidin g effect only happens when the anchor tag immediately follows the 'testing.php' portion of the url like this:

.../testing.php#result

Is there a way to pass the data in a URL after the anchor tag and extract it with php? OR Is there a way to force the sliding effect?

Thanks guys.


If you are loading the new page into the dom via jQM's ajax-handling of links then you can omit the hash portion of the url. When jQM loads the new page into the dom it only load the portion of the page within the data-role="page" element. So if you use a url like:

/testing.php?first=A

and testing.php outputs a page like this:

<div data-role="page" id="testing_<?php echo $_GET['first']; ?>">
    ...
</div>

then the rest of the website can use the id (testing_A) output by testing.php to reference the newly added page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜