Forum Moderators: open

Message Too Old, No Replies

Ajax w/ IE help

         

GameDevelop

11:35 am on Aug 12, 2009 (gmt 0)

10+ Year Member



I'm having a problem with a chat box on a site. When the users have IE 7 or 8 and they are in the chat box, for some reason they keep sending blank messages. Here's the string thats causing the problems. Whats wrong here?

The problem code is here:

var addr = "/common/ajax/chatSend.php";
var tosend = "line=" + encodeURIComponent(textbox.value);

requester.open("POST", addr, true);
requester.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
requester.onreadystatechange = doNothing;
requester.send(tosend);

Instead of sending the "tosend" string, it's not sending anything, so the php script isn't getting the post variable.

whoisgregg

9:30 pm on Aug 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, GameDevelop!

The first thing I would check is to see if the problem is on that last line or higher up in the page. Assuming you have access to a machine with IE7 or IE8 installed, try adding some temporary alert() messages to see what these different variables are set to:

 alert(tosend); 
alert(textbox.value);
alert(textbox);

If those are all what you expect them to be, I would next look at the XMLHttpRequest object itself. I'd take a look at what RonPK posted in this thread [webmasterworld.com] and see if that applies in your case.

One more thing, do you have an actual function defined called "doNothing?" If you don't, IE7 might be choking on the undefined function.

Post back with your debugging progress and we'll do our best to help. :)