donglu5041 2012-07-10 16:41
浏览 58

jQuery AJAX脚本无法在Firefox中运行

I can't figure out why this script won't work in Firefox. And, even though my ajax_loadmore.php outputs FALSE, it still makes the AJAX-call (in Chrome).

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 code:

<?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..'); }

?>
  • 写回答

2条回答 默认 最新

  • dsifjgogw48491752 2012-07-10 17:03
    关注

    I was also faced with the same problem, and I used the script from the following link:

    http://www.9lessons.info/2009/07/load-data-while-scroll-with-jquery-php.html

    评论

报告相同问题?

悬赏问题

  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配