vincea Posted October 19, 2006 Share Posted October 19, 2006 Ok well this is a basic script.. but won't work in IE. Works in Opera, Navigator, Firefox but not in IE.. of course.Basically all it does is load a .php file when the link is clicked making Ajax show the .php file in a <div>BUT IE refuses to co-operate with the text link command, I have tried different variants and still nothing. It is IE 6.the code....The menu link in the body of the page which submits the php file and the div ID[code]<li><a href="#" onClick="getData('member.php?mem=mike', 'contentContainer')">» Mike</a></li>[/code]and here is the basic XMLHttpRequest object in the head..[code] var XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { HttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); } function getData(dataSource, divID) { if (XMLHttpRequestObject) { var obj = document.getElementById(divID); XMLHttpRequestObject.open("GET", dataSource); XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 1) { obj.innerHTML = "<div id='load'>Loading.. <img src='spinner.gif'></div>"; initLightbox(); } if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { obj.innerHTML = XMLHttpRequestObject.responseText; } } XMLHttpRequestObject.send(null); } }[/code]Any help would be great...Vince Quote Link to comment Share on other sites More sharing options...
ober Posted October 19, 2006 Share Posted October 19, 2006 Umm... you're naming the object 2 different things.[code]if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP"); }[/code]Try that. That would be why IE isn't working, because you're never doing anything with IE's object. Quote Link to comment Share on other sites More sharing options...
vincea Posted October 19, 2006 Author Share Posted October 19, 2006 hahaha good eye.. i overlooked that.. i'm retarded. Ok i will give that a shot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.