Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript
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 28-Mar-13 2:59am
Edited 28-Mar-13 3:02am
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try using ajax function.
 
$.ajax({
url: url,
data: data,
success: success,
dataType: dataType
});
 
refer this http://api.jquery.com/jQuery.get/[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 5,170
1 DamithSL 4,357
2 Maciej Los 3,750
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,851


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 29 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100