0
if (window.XMLHttpRequest)
  {
  xhttp=new XMLHttpRequest();
  }
else // Internet Explorer 5/6
  {
  xhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xhttp.open("GET","cd_catalog.xml",false);
xhttp.send("");

=============
this code working in IE but not working in Other Browser pls help me

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by xylude
0

Try this:

function ajaxHandler(endParams, returnId)
{
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try
		{
			// Opera 8.0+, Firefox, Safari
			ajaxRequest = new XMLHttpRequest();
		} 
	catch (e)
		{
			// Internet Explorer Browsers
			try
				{
					ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
				} 
			catch (e) 
				{
					try
						{
							ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
						} 
					catch (e)
						{
							// Something went wrong
							alert("Your browser broke!");
							return false;
						}
				}
		}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
		{
			if(ajaxRequest.readyState == 4)
				{
					document.getElementById(returnId).innerHTML = ajaxRequest.responseText;
				}
		}
	
	ajaxRequest.open("GET", "the_path_to_page" + endParams, true);
	ajaxRequest.send(null); 
}

Took that straight from a tutorial somewhere. Works good for me

Edited by xylude: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.