Im currently working on a VERY simple AJAX-PHP chat, it works well, doesnt work in IE, but works in every other browser.
Why is that?
Im posting this here because I beleive this is a AJAX problem, not php.
Chat.php:
Code:
</style>
<body onload="ajaxFunction('get.php',1);">
<P id=labelr>
</P>
<HR>CHAT:<input id=nick> : <input id=chat> <a href="javascript:submitr();">Submit</a>
<script type="text/javascript">
function ajaxFunction(url,labelc)
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
if (labelc==1){
document.getElementById('labelr').innerHTML=xmlHttp.responseText;
}
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
setTimeout("ajaxFunction('get.php',1)",150);
}
</script>
<script type="text/javascript">
function submitr()
{
ajaxFunction("put.php?nick="+document.getElementById('nick').value+"&chat="+document.getElementById('chat').value,0);
}
</script>
get.php:
Code:
get the chat and parses it.
put.php:
Online Version
^ This is whats not working in IE ^
Thanks if any1 helps me, if its a php problem please tell me and Ill make a new topic in php section.
~Mini
EDIT:
IN IE it works, you can view chat and submit chat, but when new chat comes in it doesnt get the new chat, you must reload the page manualy, why is this?