Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi All,

I got an error......Invalid argument

Here my script.....

<html>
<head></head>
<body>

<form id="Form1" method="post" runat="server">
<input type="button" onclick="MakeXMLHTTPCALL();"value="Call XMLHTTP"/>
<br/>
<br/>
<div id="MyDiv">{No result} </div>
</form>

<script type="text/javascript">

	function MakeXMLHTTPCALL()
	{
		if(window.XMLHttpRequest)
		{
	 	XmlHttpObj=new XMLHttpRequest();
	 
		}

		else
		{
	  	 	try
 			{
			xmlHttpObj= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{
			xmlHtppObj= new ActiveXObject("Msxm12.XMLHTTP");
		
			}	
		}
	  
		
		if(XmlHttpObj)
		{
		  XmlHttpObj.open("GET","C:\JavaScript\XMLHTTPOBJECT\DataFile.xml",true);	.......ERROR....<<Invalid Argument>>.....
		
		  XmlHtppObj.onreadystatechange=function()
			{
			 if(XmlHttpObj.readyState==READYSTATE_COMPLETE)
			   {
			    document.getElementById("MyDiv").childNode[0].nodeValue=XmlHttpObj.responseText;
			   }
			}
		XmlHttpObj.send(null);
			
		}
		 
	}	

</script>
</body>
</html>



Kindly help me here....

Thanks...
Posted
Updated 28-Mar-13 2:02am
v3

Try and replace the XML URL path in the below example with your local drive XML path. I never try reading XML from local drive before but I think it should work in your local environment as long as you provide the full path (c:\xml\myxml.xml).

Reading XML with jQuery[^]

another example on how to do it

ASP.NET Slideshow Control with jQuery and XML[^]
 
Share this answer
 
Try using ajax function.

$.ajax({
url: url,
data: data,
success: success,
dataType: dataType
});


refer this http://api.jquery.com/jQuery.get/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900