views:

135

answers:

2

Hi! I am working on a small chat application that uses jQuery to get some info from a PHP file. The output of the file is a whole bunch of HTML data.

The script works just fine in FF but not in Internet (f***ing) Explorer, lol. The code looks like this:

$.get("index.php", {p: "chatData", type: "regular"}, function(data){
     startPoint = data.indexOf("|START-POINT|");
     endPoint = data.indexOf("|END-POINT|");
     dataReturn = data.substring(startPoint, endPoint);
});

The thing is, that I have to access some SESSION variables inside my chatData.php file. Therefore I call index.php with p-varable, that includes chatData.php into my index.php file where the SESSION variables is set. This is maybe not the best sollution, but I couldn't think of another way to access the SESSION variables. Anyway.

But when I'm doing like this, the callback will contain all html from index.php as well, but I only want the data from chatData.php, so therefore I put these start- and endPoints into the code, so it can do substring and get the desired data that way. Same thing here, maybe not the best sollution...

But now the issue! The callback data only contains the html from index.php, it sould be the index.php html + the chatData html... But I think the issue lies in this index.php inclusion, because if I call the file like usual, I will get the data (tho, as I said, I need the SESSION variables from index.php as well...).

So why doesn't this work in IE, but just fine in other broswers such as FF ?

EDIT: The problem is solved. The problem was my START-POINTS in my php file, they were wrongly placed... Sorry about that noobish misstake. Thank yuo anyway!

+2  A: 

Have you checked that index.php get those parameters you sent to it and include your other file? Just seems like it doesn't, HTML can't magically disappear :) Maybe IE set it as $_POST variables as opposed to Firefox that does it through $_GET or something.

vava
A: 

IE caches ajax requests by default. You can solve this at 2 ways:

  1. Set cache option of jQuery.ajax() to false.
  2. Append a querystring with a timestamp to the URL.

Edit: oh, you already solved it yourself .. Anyway hope the above information is still useful. You never know with IE in the future.

BalusC