我有一个通知系统,我正试图将它放入一个 jquery 移动应用程序中。该系统在我的网站上运行,但我很难让它在网络应用程序中运行。应该发生的是,当我单击通知链接时,面板会打开,并显示我的通知。相反,它什么也没显示。
这是我的页面代码:
<?php
//INFO FOR CONNECTING TO DATABASE AND SETTING $username.
?>
<!DOCTYPE html>
<html>
<head>
<!--THIS IS FOR THE NOTIFICATIONS-->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
function toggleDiv(divId) {
$("#"+divId).toggle();
$(document).ready(function(){
$("#myContent").load("http://www.1511project.com/getnotes.php?name=<? echo $username; ?>");
});
}
</script>
<!--END AJAX FOR NOTIFICATIONS-->
<script type= "text/javascript" src = "countries.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>15:11 Project Mobile</title>
<link rel="stylesheet" href="css/jquery.mobile-1.3.0.css" />
<link rel="stylesheet" href="css/style.css" />
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">
<script src="js/jquery-1.8.3.js"></script>
<script src="js/jquery.mobile-1.3.0.js"></script>
<!--THIS IS FOR THE SHARE BUTTON-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$('.toggleNotes').click(function() {
$nextArticle = $(this).next('.article');
$nextArticle.is(':visible') ? $nextArticle.slideUp() : $nextArticle.slideDown();
return false;
});
});
</script>
</head>
<body>
<?
//THIS GETS THE NUMBER OF UNREAD NOTIFICATIONS
$readquery = mysql_query("SELECT * FROM notifications WHERE (needs='$username' AND needsread='0' AND type='workneed') OR (worker='$username' AND workerread='0')");
$number = mysql_num_rows($readquery);
?>
<!-- BEGIN PAGE 1 -->
<div data-role="page" id="feed" data-add-back-btn="true">
<div data-role="panel" id="settingspanel" data-position="left" data-display="overlay">
<!--THIS IS WHERE THE SETTINGS PANEL GOES-->
</div>
<div data-role="header" data-position="fixed" data-theme="c" data-tap-toggle="false" data-id="foo1" style="padding-top: 5px; border-bottom: 1px solid #eccfb3; padding-bottom: 5px;">
<a href="#settingspanel" data-role="button" data-iconpos="notext" class="icon-reorder icon-2x" style="background: none; margin-left: 20px;"></a>
<center><img src="images/logo_app_white.png" height="25px"></center>
<a href="#myContent" data-role="button" data-iconpos="notext" class="icon-bell-alt icon-2x" style="background: none; margin-right: 20px;"></a><? echo $number; ?>
</div>
<div data-role="content">
*****The page content goes here*********
</div>
<!--THIS IS THE PANEL THAT SHOULD DISPLAY THE NOTIFICATIONS-->
<div data-role="panel" id="myContent" data-position="right" data-display="overlay">
</div>
</div>
<!-- END PAGE 1 -->
这是 getnotes.php 页面,它获取要显示的信息:
<?
$username = $row['username'];
$query = mysql_query("SELECT * FROM notifications WHERE needs='$username' OR worker='$username' ORDER BY CASE WHEN needs = '$username' THEN needsread ELSE workerread END, time DESC");
while ($rows = mysql_fetch_array($query)) {
$needs = $rows['needs'];
$id = $rows['ID'];
$worker = $rows['worker'];
$title = $rows['title'];
$needsread = $rows['needsread'];
$workerread = $rows['workerread'];
$time = $rows['time'];
$type = $rows['type'];
if ($needsread == "0" && $username == "$needs" && $type== "workneed") {
echo "<div style='background-color:#FFFFFF; border-color:#000000; border-width:1px; border-style:solid;'>$worker signed up to work your need: $title.</div>";
mysql_query("UPDATE notifications SET needsread='1' WHERE ID='$id'");
}
if ($workerread == "0" && $username == "$worker" && $type== "workneed") {
echo "<div style='background-color:#FFFFFF; border-color:#000000; border-width:1px; border-style:solid;'>You signed up to work $needs's need: $title.</div>";
mysql_query("UPDATE notifications SET workerread='1' WHERE ID='$id'");
}
if ($workerread == "1" && $username == "$worker" && $type== "workneed") {
echo "<div style='background-color:#d3d3d3; border-color:#000000; border-width:1px; border-style:solid;'>You signed up to work $needs's need: $title.</div>";
}
if ($needsread == "1" && $username == "$needs" && $type== "workneed") {
echo "<div style='background-color:#d3d3d3; border-color:#000000; border-width:1px; border-style:solid;'>$worker signed up to work your need: $title.</div>";
}
if ($workerread == "0" && $username == "$worker" && $type == "follow") {
echo "<div style='background-color:#FFFFFF; border-color:#000000; border-width:1px; border-style:solid;'><a href='viewprofile.php?viewusername=$needs'>$needs</a> started following you.</div>";
mysql_query("UPDATE notifications SET workerread='1' WHERE ID='$id'");
}
if ($workerread == "1" && $username == "$worker" && $type == "follow") {
echo "<div style='background-color:#d3d3d3; border-color:#000000; border-width:1px; border-style:solid;'><a href='viewprofile.php?viewusername=$needs'>$needs</a> started following you.</div>";
}
}
?>
任何想法为什么它可以在我的网站上运行但不能在我的 jquery 移动网络应用程序上运行?