简体   繁体   English

jQuery .load在IE8中不起作用

[英]jQuery .load doesn't work in IE8

I'm using a script to load another page with a post value in it to update a SQL query. 我正在使用脚本来加载另一个页面,该页面中具有发布值以更新SQL查询。 It works in safari but doesn't work in IE8. 它可以在Safari中使用,但在IE8中不起作用。 I don't know how to fix it. 我不知道该如何解决。 As you can see the page is all blank but does contain the element. 如您所见,页面全为空白,但包含元素。 So I'm assuming that there is something wrong with the .load function. 所以我假设.load函数出问题了。

link: http://tamara.gwst.nl/infiniteScroll/index.php 链接: http//tamara.gwst.nl/infiniteScroll/index.php

index.php index.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 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});


        }
    });

});

scroll.php scroll.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>";
}

?>

Not sure if it's the cause of your bug but 不知道这是否是您的错误的原因,但是

$("document").ready(function(){ ... }

should be 应该

$(document).ready(function(){ ... }

You want the JS variable document not the string "document" . 您需要JS变量document而不是字符串"document"

This might be a caching problem. 这可能是一个缓存问题。

Try , 试试看

$("#content").load("scroll.php?" +Math.random()*99999, {limit: counter});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM