$(".videos").append('<ul><li><div class="videos_image"><a> href="pagevideo/"<img src="/media/images/' + data.image + '" width="250" height="180" /></a></div>
<div class="videos_title">' + data.title + '</div><div class="videos_views"><p> Просмотров:' + data.views +'</p></div></li></ul>');
$num = $_GET("num");
echo $num;
$.ajax({
url: 'load.php',
method: 'GET',
dataType: 'json',
data: "num="+num,
beforeSend: function(){
inProcess = true;
},
success: function(data){
console.log(data);
}
$num = $_GET("num");
echo $num;
/*Обратите внимание, как я подключаюсь к базе. Почему так? Потому что так правильнее*/
$db = new mysqli('localhost','user','pass','database');
if(mysqli_connect_errno()){
echo mysqli_connect_error();
}
/*надеюсь не надо объяснять, что тут происходит?*/
require_once "includes/config.php";
$num = $_GET("num");
$res = $db->query("SELECT * FROM `videos` ORDER BY `id` DESC LIMIT '$num', 10");
$videos = array();
while($row = mysqli_fetch_array($res)){
$videos[] = $row;
}
echo json_encode($videos);
require_once "includes/config.php";
$num = $_GET("num");
$res = $db->query("SELECT * FROM `videos` ORDER BY `id` DESC LIMIT '$num', 10");
$videos = array();
while($row = $res->mysqli_fetch_array()){
$videos[] = $row;
}
echo json_encode($videos);
require_once "includes/config.php";
$num = $_GET("num");
$res = $db->query("SELECT * FROM `videos` ORDER BY `id` DESC LIMIT '$num', 10");
$videos = array();
while($row = $res->fetch_array(MYSQLI_ASSOC)){
$videos[] = $row;
}
echo json_encode($videos);
require_once "includes/config.php";
$num = $_GET['num'];
$res = mysqli_query($connection, "SELECT * FROM `videos` ORDER BY `id` DESC LIMIT $num, 10");
$videos = array();
while($row = mysqli_fetch_array($res)){
$videos[] = $row;
}
echo json_encode($videos);
$num = $_GET['num'];
$res = mysqli_query("SELECT * FROM `videos` ORDER BY `id` DESC LIMIT '".$num."', 10");
$videos = array();
while($row = mysqli_fetch_array($res)){
$videos[] = $row;
}
echo json_encode($videos);
require_once "includes/config.php";
$num = $_GET['num'];
$res = mysqli_query($connection, "SELECT * FROM `videos` ORDER BY `id` DESC LIMIT $num, 10");
$row = mysqli_fetch_array($res);
echo json_encode($res);
var num = 20;
var inProcess = false;
$(window).scroll(function(){
if ($(window).scrollTop() + $(window).height() >= $(document).height() && !inProcess ){
$.ajax({
url: 'load.php',
method: 'GET',
dataType:'json',
data: "num="+num,
beforeSend: function(){
inProcess = true;
},
success: function(data){
var count = 0;
for(o in data){
count++;
}
If(count > 0){
$.each(data, function(index, data){
$(".videos").append('<ul><li><div class="videos_image"><a href="pagevideo/"<img src="/media/images/' + data.img + '" width="250" height="180" /></a></div><div class="videos_title">' + data.title + '</div><div class="videos_views"><p> Просмотров:' + data.views +'</p></div></li></ul>');
});
inProcess = false;
num += 10;
}
}
});
}
});
var num = 20;
var inProcess = false;
$(window).scroll(function(){
if ($(window).scrollTop() + $(window).height() >= $(document).height() && !inProcess ){
$.ajax({
url: 'load.php',
method: 'GET',
dataType:'json',
data: "num="+num,
beforeSend: function(){
inProcess = true;
},
success: function(data){
$.each(data, function(index, data){
$(".videos").append('<ul><li><div class="videos_image"><a href="pagevideo/"<img src="/media/images/' + data.img + '" width="250" height="180" /></a></div><div class="videos_title">' + data.title + '</div><div class="videos_views"><p> Просмотров:' + data.views +'</p></div></li></ul>');
});
inProcess = false;
num += 10;
}
});
}
});
$(".videos").append('<ul><li><div class="videos_image"><a href="pagevideo/"><img src="/media/images/' + data.image + '" width="250" height="180" /></a></div><div class="videos_title">' + data.title + '</div><div class="videos_views"> <p> Просмотров:' + data.views + ' </p> </div></li></ul>');
if( $(window).scrollTop() + $(window).height >= $(document).height() && !inProcess ) {
$(window).height()
вместо $(window).height