XMLHttpRequest() function not work with IE 8. But its woking properly with other browsers.

Ex:

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }

I need a code for IE 8 also.

Thanks
Puritha

Any reason you can't use jQuery? It seems to do all the compatibility stuff for ajax just fine. If not, try swapping that code block with this one.

try
		{
			// Opera 8.0+, Firefox, Safari
			xmlhttp = new XMLHttpRequest();
		} 
	catch (e)
		{
			// Internet Explorer Browsers
			try
				{
					xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				} 
			catch (e) 
				{
					try
						{
							xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
						} 
					catch (e)
						{
							// Something went wrong
							alert("Your browser broke!");
							return false;
						}
				}
		}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.