I have this code working prefect in Firefox, but in IE 7, 8 I am getting “Object doesn’t support this property or method” anyone any ideas ??
It’s failing at the area highlighted in red…
Thanks!
function(str)
{
if (str=="")
{
document.getElementById("getprev").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
[COLOR="Red"][B] xmlhttp=new XMLHttpRequest();[/B][/COLOR] }
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("getprev").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getprev.php?q="+str,true);
xmlhttp.send();
},
Hi
Thanks for the reply;
It appears I got it working for the moment.
I’m a newbie to all this so some feed back would be appreciated
URL http://www.lottostats.ie/lottoResults/
Thanks again !
How are you calling the function? Because it doesn’t have a name and there’s a comma at the end, it looks like it’s either a method of an object, or passed as an argument to another function. Can you give a little more context (or, even better, a live link)?
I tried the following, and it worked in IE8 and IE8 compatibility:
function test(str) {
if (str == "") {
document.getElementById("getprev").innerHTML="";
return;
}
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
alert(xmlhttp.responseText);
}
}
xmlhttp.open("GET","test.php?q=" + str,true);
xmlhttp.send();
}
test("world");
// test.php
echo 'Hello, '.$_GET['q'];