为什么在我调用$ .mobile.changePage后不会显示页面

时间:2013-04-03 11:30:47

标签: php jquery-mobile

我在这里搜索了一些问题,我可能只是没有得到它,继承我的代码

当我调用check-event.html时,页面加载正常。当我从我的php脚本check-event.php中使用$ .mobile.changePage调用check-event-details.html时,没有任何东西从标题中加载。这一切都适用于window.location =但我想使用ajax运动。

的index.html

   <!DOCTYPE HTML>
<html>
<head>
      <meta charset="utf-8" />
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black" />
        <title>
        </title>
        <link rel="stylesheet" href="css/logout-button.min.css" />
        <link rel="stylesheet" href="css/jquery.mobile-1.3.0.min.css" />
        <link rel="stylesheet" href="css/my.css" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        </script>
        <script src="js/jquery.mobile-1.3.0.min.js"></script>
        <script src="js/jquery.cookies.2.2.0.min.js"></script>

<script type="text/javascript">
var uid = $.cookies.get( 'uid' );
 if(uid == null)
                 {
                window.location ='account-login.html'; }
                 else
                 { }
</script>
</head>

<body>
   <div data-role="page" id="index">
            <div data-theme="a" data-role="header">
                <h3>
                   Options
                </h3>
            </div>

             <div data-role="content">
        <ul data-role="listview" data-divider-theme="b" data-inset="true">
            <li data-role="list-divider" role="heading">
                Menu
            </li>
            <li data-theme="c">
                <a href="event-details.html" data-transition="slide">
                    Create Event
                </a>
            </li>
            <li data-theme="c">
                <a href="check-events.html" data-transition="slide">
                    Check Events
                </a>
            </li>
        </ul>
    </div>     
    <div data-role="content">
        <a data-role="button" id="logout" data-icon="info" data-theme="f" data-iconpos="left">Log-Out</a>
    </div>  
</body>

<script>
$("#logout").click( function()
           {
             $.cookies.del( 'uid' );
             $.cookies.del( 'pass' );
             window.location ='account-login.html';
           }
        );
    </script>

</html>

签events.html

<!DOCTYPE HTML>
<html>
<head>
      <meta charset="utf-8" />
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black" />
        <title>
        </title>
        <link rel="stylesheet" href="css/logout-button.min.css" />
         <link rel="stylesheet" href="css/jquery.mobile-1.3.0.min.css" />
        <link rel="stylesheet" href="css/my.css" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        </script>
        <script src="js/jquery.mobile-1.3.0.min.js"></script>
        <script src="js/jquery.cookies.2.2.0.min.js"></script>


<script type="text/javascript">
var uid = $.cookies.get( 'uid' );
 if(uid == null)
                 {
                window.location ='account-login.html'; }
                 else
                 { }
</script>
</head>

<body>


   <div data-role="page" id="index1">

           <div data-theme="a" data-role="header">
        <a data-role="button" data-direction="reverse" data-rel="back" data-transition="slide"
         data-icon="arrow-l" data-iconpos="left" class="ui-btn-left">
            Back
        </a>
        <h3>
           Check Events
        </h3>
    </div>

 <div data-role="content">

 <div id="content"></div>

        <script>
            $(function(){
            $("#content").load(("check-events.php"), function(){
            $('#content').trigger("create");
        });
        return false;

});
</script>


    </div>  
</body>
</html>

签events.php

<?
require_once("../backend/functions.php");
dbconn();
?>
<script>
 $('form').submit( function(){
       return submitForm.call( this );
 });
</script>
<script>
function submitForm() {
       // alert the id of the form that was clicked

    var eventid = this.id;
    $.cookies.set( 'eventidcookie', eventid );
    $.mobile.changePage( "check-events-details.html", { transition: "slide"} );

    return false;
}
</script>

<?
 //window.location ='check-events-details.html';   
 $id = $CURUSER["id"]; 
 $e= date("Y/m/d");              
    $a = SQL_Query_exec("SELECT * FROM cal_events WHERE userid = '$id' AND enddate > '$e' ORDER BY enddate ASC");

if (mysql_num_rows($a) == 0) {
?>
<script>
alert("You have no active events to deal with");
window.location ='index.html'; 
</script>
<?
}else{
while($rowa = mysql_fetch_array($a))
{ 
?>
<form id="<? echo $rowa[eventid]; ?>">
 <ul data-role="listview" data-divider-theme="b" data-inset="true">
            <li data-role="list-divider" role="heading">
                Finishing Time: <? echo date("jS F Y",strtotime($rowa[enddate])); ?>
            </li>
            <li data-theme="c">
               <input type="submit" value="<? echo $rowa[eventname]; ?>" id="submitEventButton">
            </li>
        </ul>
</form>
<?
}
}
?>

签事件details.html

<!DOCTYPE HTML>
<html>
<head>
      <meta charset="utf-8" />
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black" />
        <title>
        </title>
        <link rel="stylesheet" href="css/logout-button.min.css" />
         <link rel="stylesheet" href="css/jquery.mobile-1.3.0.min.css" />
        <link rel="stylesheet" href="css/my.css" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        </script>
        <script src="js/jquery.mobile-1.3.0.min.js"></script>
        <script src="js/jquery.cookies.2.2.0.min.js"></script>


<script type="text/javascript">
var uid = $.cookies.get( 'uid' );
 if(uid == null)
                 {
                window.location ='account-login.html'; }
                 else
                 { }
</script>
</head>

<body>


   <div data-role="page" id="index2">

           <div data-theme="a" data-role="header">

        <h3>
           Check Event Details
        </h3>
    </div>

 <div data-role="content">

 <div id="content"></div>

        <script>
            $(function(){
            $("#content").load(("check-events-details.php"), function(){
            $('#content').trigger("create");
        }).trigger("create");
        return false;

});
</script>      

来自Jquery网站就是这个原因 jQuery Mobile目前仅支持通过AJAX加载单页文档。要导航到多页文档,您必须通过添加数据-ajax =&#34; false&#34;来禁用链接上的ajax。属性。还有一个小部件允许通过

支持子页面

0 个答案:

没有答案