好的我從一開始就重新發布。我對此感到沮喪,因爲我即將放棄JQM。這不應該這麼難。返回Jquery站點的主頁時無法訪問腳本
我的網站結構:
OUI/
index.php
js/
pages/
images/
在我的index.php頁面我剛一二線形式登錄我在http://localhost/~me/OUI/
:
<? session_start();
?><!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=false,initial-scale=1;">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="js/jquery.mobile-1.4.0.min.css">
<link rel="stylesheet" type="text/css" href="css/jqm-datebox.min.css" />
<script src="js/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="js/jquery.mobile-1.4.0.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jqm-datebox.comp.datebox.min.js"></script>
<script src="js/mainsite.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/main.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>OUI CHEF</title>
</head>
<body style="background-image:url(media/kitchen.jpg)">
<div data-role="page" id="loginarea">
<div data-role="content" id="maincontentarea2">
<img src="media/OUIChef.png" style="margin-top:75px" id="mainimage">
<div data-role="fieldcontain" class="ui-hide-label">
<label for="username">Username:</label>
<input type="text" name="username" id="username" value="" style="text-align:center" placeholder="Username"/><BR>
<label for="username">Password:</label>
<input type="password" name="password" id="password" value="" style="text-align:center" placeholder="Password"/>
</div>
<div style="text-align:center">
<a href="javascript:doLogin();" data-role="button" data-inline="true" data-mini="true">DO LOGIN</a>
</div>
</div><!-- /page -->
</div>
</body>
</html>
所以,當我打的登錄按鈕它帶我到我的options.php頁面vi以下功能:
function doLogin(){
$.ajax({
type: "POST",
url: "functions/checklogin.php",
data: {
usrnm: $('#username').val() , passwd: $('#password').val()
}
})
.done(function(msg) {
if(msg.match(/YES/)){
$('#username').val('');
$('#password').val('');
$("body").pagecontainer("change","pages/options.php",{ });
}
else
{
alert(msg);
}
});
}
在URL欄中我現在有http://localhost/~me/OUI/pages/options.php
和頁面上的任何東西都運行良好。我有登出按鈕。在代碼中調用該
OPTIONS.PHP:
<div data-role="page" id="optionspage">
<div data-role="header">
<a href="javascript:doSignout();" data-role="button" data-mini="true" class="ui-btn-right" style="padding:5px">Sign Out</a>
<h1>MAIN</h1>
</div>
<div data-role="content" id="options1">
<? if($_SESSION['role']=='A'){?>
<a href="admin.php" data-role="button" data-mini="true">ADMIN PAGE</a>
<a href="ordersetup.php" data-role="button" data-mini="true">ORDER SETUP PAGE</a>
<? } ?>
<a href="production.php" data-role="button" data-mini="true">PRODUCTION</a>
<a href="menurecipe.php" data-role="button" data-mini="true">MENU/RECIPE PAGE</a>
</div><!-- /content -->
</div>
這個調用JS:
function doSignout(){
$.ajax({
type: "POST",
url: "../functions/signout.php",
data: { }
})
.done(function(msg) {
$('body').pagecontainer("change", "#loginarea",{});
});
}
我永遠無法得到的鏈接signout頁面正確鏈接。如果我把雙點應該是正確的,從「頁」文件夾中,我得到它試圖鏈接到
http://localhost/~me/functions/signout.php
,如果我去掉雙點我得到
http://localhost/~me/OUI/pages/functions/signout.php
這兩者都是404錯誤.......這是我的書中的BUNK。 「..」實際上是刪除兩個目錄..不只一個。
發生了什麼事? PLease幫助
如果登錄腳本失敗,爲什麼你沒有提供該代碼? –
它不是登錄腳本。一旦我運行doSignout Javascript,就可以訪問任何東西。就好像Jquery移動失去了AJAX加載任何東西的能力。 – BostonMacOSX
退房http://stackoverflow.com/questions/19174611/how-to-change-page-in-latest-jquery-mobile-1-4-beta – user583576