views:

156

answers:

2

Following from this thread: http://stackoverflow.com/questions/2209260/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.

A: 

Start by getting the Fiddler2 addon for IE that will let you inspect your HTTP traffic.

With that you'll be able to verify that you are sending the correct request and returning the correct response.

Also verify using view-source or the IE developer tools that you aren't getting the content back ok, but somehow IE isn't showing it (e.g. it is in the source, but not visible)

For example if you were trying to set your returned HTML as the content of a Table or Select list... this would fail in IE.

scunliffe
+1  A: 

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

useless