Jump to content

Runtime Error - Loading File


lilman

Recommended Posts

I am getting a runtime error on I.E. but not on FireFox.  Below is the code:

 

function ajaxLoader(url,id)
{
if (document.getElementById) 
{
	var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
}

if (x)
{
	x.onreadystatechange = function()
	{
		if (x.readyState == 4 && x.status == 200)
		{
			el = document.getElementById(id);
			el.innerHTML = x.responseText; // This is the line it says the error is happening on
		}
	}

	x.open("GET", url, true);
	x.send(null);
}
}

 

 

Link to comment
Share on other sites

put this

x.open("GET", url, true);

before this

x.onreadystatechange = function()
	{
		if (x.readyState == 4 && x.status == 200)
		{
			el = document.getElementById(id);
			el.innerHTML = x.responseText; // This is the line it says the error is happening on
		}
	}

Link to comment
Share on other sites

el.innerHTML = x.responseText; // This is the line it says the 

what is the resonseText?  ie can be finicky about what you try to innerHTML into something.  it can have problems with forms, complex html, and js.  Or are you trying to inject a block level item into an inline item, like innerHTML a div or a ul into a span? You can't do that.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.