douna6802 2010-02-06 12:39
浏览 42
已采纳

AJAX UPDATE + PHP + IE =失败?

Following from this thread: Another IE jQuery AJAX/post problem (please read the thread to understand this one)

Now i've got an solution for the thread above.. But, the ok.php (the site it updates each 10 seconds, with AJAX script) Doesn't show in IE if the response contain HTML code. With this I mean, if i have: (ok.php)

<?php
ob_start();
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('Content-type: text/html; charset=utf-8');
ob_flush();
echo "hello";
?>

It will work in both IE and FF... However if i have: (in ok.php)

<?php
ob_start();
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('Content-type: text/html; charset=utf-8');
ob_flush();
include "../tilslut.php";
$sql = "SELECT id FROM member_comments WHERE fID = '19'";
 $query = mysql_query($sql);
 $number = mysql_num_rows($query);
 echo("There is <b>".$number."</b> comments!<br><br>");
?>

It will work/show only in firefox, not in IE.

Help me out! :( Thank you in advance.

  • 写回答

2条回答 默认 最新

  • dqb14659 2010-02-07 00:09
    关注

    maybe the path try to use include(dirname(__FILE__).'/../tilslut.php'). This should throw you errors but its better to do it that way. Try to put the ajax_update in a script like this:

    <script>
    jQuery(document).ready(function(){ajax_update();});
    </script>
    

    instead of the onload

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败