Jump to content


Photo

I wish I could blow up IE.. need some help


  • Please log in to reply
2 replies to this topic

#1 vincea

vincea
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 19 October 2006 - 06:58 PM

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
<li><a href="#" onClick="getData('member.php?mem=mike', 'contentContainer')">&raquo; Mike</a></li>


and here is the basic XMLHttpRequest object in the head..
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);
		}
	}

Any help would be great...
Vince

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 19 October 2006 - 07:00 PM

Umm... you're naming the object 2 different things.
if (window.XMLHttpRequest) {
		XMLHttpRequestObject = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
	}

Try that.  That would be why IE isn't working, because you're never doing anything with IE's object.

Info: PHP Manual


#3 vincea

vincea
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 19 October 2006 - 07:12 PM

hahaha good eye.. i overlooked that.. i'm retarded. Ok i will give that a shot




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users