ajax.php
<?php
require("ayar.php");
if($_POST){
sleep(2);
$id = $_POST["id"];
$bul = mysql_query("select * from konular where id < $id order by id DESC limit 10");
$say = mysql_num_rows($bul);
if ($say > 0){
while ($veri = mysql_fetch_array($bul)){
echo '<li id="'.$veri["id"].'">'.$veri["yazar"].'</li>';
}else{
echo "bos";
}
}
}
?>
//index2.php
<?php require_once("ayar.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>Veri</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
$(function(){
$("#blok").scroll(function(){
if($(this).scrollTop() === $(".blok").height()){
$("#loader").show();
var id = $(".blok ul li:last").attr("id");
$.ajax({
type: "POST",
url: "ajax.php",
data: {"id":id},
success: function(veri){
if(veri == "bos"){
$("#loader").html("Başka Veri Yok !")
}else
$("blok ul").append(veri);
$("#loader").hide();
}
}
});
}
});
});
</script>
<style type="text/css">
body {margin:auto; font: 12px/21px Arial}
ul,li {padding: 0; margin: 0; list-style: none}
#blok {width: 250px; height: 300px; position: fixed; top:0; right: 0; background-color:#f1f1f1; border:1px solid #CCC; overflow:auto;}
.blok ul li {padding: 10px; border-bottom: 1px solid #ddd;}
#loader {background-color: #fff; border: 1px solid #ccc; margin: 10px; padding: 8px; text-aling: center; margin:auto; display:none; }
</style>
</head>
<body>
<div id="blok">
<div class="blok">
<ul>
<?php
$bul= mysql_query("select * from konular order by id DESC limit 10");
while($veri = mysql_fetch_array($bul)){
echo'<li id="'.$veri["id"].'">'.$veri["yazar"].'</li>';
}
?>
</ul>
<div id="loader"><img src="loader.gif" alt=""/>
</div>
</div>
</div>
</body>
</html>
arkadaşlar ajax.php hata var bir türlü anlamadım
Scroll ile Veri Yükleme
6
●425
- 23-06-2013, 10:53:31
- 23-06-2013, 11:29:43Ajax.php Bu Şekilde Deneyin;
<?php require("ayar.php"); if($_POST){ sleep(2); // Bu niye ? $id = $_POST["id"]; $bul = mysql_query("select * from konular where id = '".mysql_real_escape_string($id)."' order by id DESC limit 10"); $say = mysql_num_rows($bul); if ($say > 0){ while ($veri = mysql_fetch_assoc($bul)){ echo '<li id="'.$veri["id"].'">'.$veri["yazar"].'</li>'; } }else{die("Veri Bulunumadı.");} } ?> - 23-06-2013, 11:36:43olmadı hocam gene aynı sonuç ama emek verdiğiniz için teşekkürler

--R10.NET; Flood Engellendi -->-> Yeni yazılan mesaj 11:36:43 -->-> Daha önceki mesaj 11:34:49 --
sleep bu niye demişsiniz hocam veri çekerken loader gözüksün niye yapmıştık tayfun erbilenin videosundakinin biraz değişiniz uyguladım - 23-06-2013, 11:37:38Hata nedir onu yazarmısınız ?GoknurTasarim adlı üyeden alıntı: mesajı görüntüle
- 23-06-2013, 11:41:00hocam verileri çekiyorum scrollu aşağı indirdiğimde loader çıkıp yeni verileri aşağı yuklemesi lazım facebooktasağ taraftaki gibi ama aşağı yeni veri gelmiyor
