尝试从PHP GET变量设置Jquery移动页面

Hi folks this is driving me crazy so please help.

I am trying to create my first mobile app using Jquery Mobile.

I have 4 pages in my script i.e.

<div data-role="page" id="home">...Page code...</div>
<div data-role="page" id="services">...Page code...</div>
<div data-role="page" id="videos">...Page code...</div>
<div data-role="page" id="blog">...Page code...</div>

Within my videos page I have a number of list items with url links to the same url with the GET parameter of ID= for the video ID i.e.

<li><a href="test.php?videoID=1"</a></li>

When the link is clicked I want to use the videoID within the videos page, but the link sends me back to the home page, and if I then click through to the videos page the videoID is lost.

How can I get straight to the video page and be able to use the videoID?

Ideally looking for a mainly php based solution, as I am quite new to jquery.

First, grab the VideoID from the URL, as follows:

if (isset($_GET['videoID'])){
$myvideo=$_GET['videoID'];
//if you want to echo the result, you can do that, i.e: echo $myvideo;
//........... your next action after getting the video ID here .........
}

For example:

$query="SELECT * FROM tablevideo WHERE videoID='$myvideo'";
........................ and so on ........

Instead of

<li><a href="test.php?videoID=1">link text</a></li>

You could use a data-attribute:

<li><a href="#" data-videoid="1" class="vidLink" >link text</a></li>

Then you can add a click handler, which retrieves the videoid from the data attribute and make an AJAX call to your php to get the video:

$(document).on("click", ".vidLink", function(){
    var vidID = $(this).jqmData("videoid");
    //make AJAX call with ID to php to get the video
});