我正在使用脚本加载另一个页面,其中包含一个 post 值以更新 SQL 查询。它在 safari 中有效,但在 IE8 中无效。我不知道如何解决它。如您所见,该页面全为空白,但确实包含该元素。所以我假设 .load 函数有问题。
链接:http ://tamara.gwst.nl/infiniteScroll/index.php
索引.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Web Gallery | Infinite Scroll</title>
<link rel="stylesheet" href="style.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="js/jquery.infinitescroll.js"></script>
</head>
<body>
<?php include('includes/connect.php'); ?>
<div id="content"></div>
</body>
</html>
main.js
$("document").ready(function(){
$("#content").load("scroll.php", {limit: 5});
var counter = 5;
$(window).scroll(function(){
if($(window).scrollTop() + 1 > $(document).height() - $(window).height() ){
counter = counter + 5;
$("#content").load("scroll.php", {limit: counter});
}
});
});
滚动.php
<? $limit = $_POST['limit']; ?>
<?
include('includes/connect.php');
$sql = "SELECT name FROM scroll_images LIMIT $limit";
echo "</div>";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
echo "<div class='post'><img src='img/".$row['name']. ".jpg' /></div>";
}
?>