このスクリプトが Firefox で機能しない理由がわかりません。そして、ajax_loadmore.php
出力が FALSE であっても、(Chrome で) AJAX 呼び出しを行います。
var request;
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height() ) {
var ID = $('.stbody:last').attr('id').match(/stbody(\d+)/)[1];
$('#loader').show();
if(request) {
return
}
request = $.ajax({
type: 'GET',
url: "ajax_loadmore.php?lCom="+ID,
success: function(result) {
if(result!='FALSE') {
$('#loader').hide();
$('#moreComments').append(result);
$(".oembed").oembed(null, {
embedMethod: "fill",
maxWidth: 700,
maxHeight: 600
});
request = null;
} else {
$('#loader').hide();
$('#moreComments').html('<center><p>Slut på inlägg</p></center>');
request = null;
}
}
});
}
});
ajax_loadmore.php
コード:
<?php
if($_GET['lCom']) {
include_once 'core/init.php';
protect_page();
include_once 'includes/db.php';
include_once 'includes/functions.php';
include_once 'includes/tolink.php';
include_once 'includes/time_stamp.php';
include_once 'session.php';
$lCom = $_GET['lCom'];
$Wall = new Wall_Updates();
$updatesarray=$Wall->Updates_more($uid,$lCom);
if(!empty($updatesarray)) {
foreach($updatesarray as $data) {
$msg_id=$data['msg_id'];
$orimessage=$data['message'];
$message=tolink(htmlspecialchars(nl2br($data['message'])));
$time=$data['created'];
$username=$data['username'];
$uid=$data['uid_fk'];
$face=get_profile_pic($uid,'small');
$face2=get_profile_pic($session_user_id,'mini');
$commentsarray=$Wall->Comments($msg_id);
?>
//HTMLSTUFF HERE..
<?php
}
} else { echo 'FALSE'; }
} else { die('du ska inte vara här..'); }
?>