Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,

I my aspx page I have to read an XML file, which is reside in server side from client side. I have to read the contents of the XML file.

Thanks,
Velkumar.
Posted
Comments
Sergey Alexandrovich Kryukov 19-Jun-12 2:29am    
"Read" or perhaps "parse"?
--SA
Sergey Alexandrovich Kryukov 19-Jun-12 2:30am    
Did you notice this is not a question? Besides, why not just finding and answer in the Web? It would be way faster...
--SA

I don't think you mean "read", as you probably know how to read any text file. You probably need parsing.

Please see this question: http://stackoverflow.com/questions/649614/xml-parsing-of-a-variable-string-in-javascript[^].

First of all, you need to look for the answers with DOMParser.

—SA
 
Share this answer
 
v2
Comments
Velkumar Kannan 19-Jun-12 2:34am    
I want to just load an XML file from server using javascript. ie. Using client side code I want to load and get the contents of a XML file.
Sergey Alexandrovich Kryukov 19-Jun-12 3:11am    
For goodness sake, what is "just load"?.. :-)
--SA
Manas Bhardwaj 19-Jun-12 6:30am    
correct +5!
Sergey Alexandrovich Kryukov 19-Jun-12 10:01am    
Thank you, Manas.
--SA
You want to know how to talk to server from Javascript.

There are few ways to interact with server side through client side(Javascript):
1. XMLHttpRequest[^]
2. Callback[^]
3. WebService call[^]
4. PageMethod[^]

If you are not using ASP.NET then XMLHttpRequest or Callback is the way.
To use XMLHttpRequest or Callback, you can use jQuery. Here, have a look:
http://api.jquery.com/jQuery.ajax/[^]
http://api.jquery.com/category/ajax/[^]
http://www.w3schools.com/jquery/jquery_ref_ajax.asp[^]
 
Share this answer
 
Comments
Velkumar Kannan 19-Jun-12 2:35am    
I want to just load an XML file from server using javascript. ie. Using client side code I want to load and get the contents of a XML file.
Sandeep Mewara 19-Jun-12 2:51am    
And using XMLHttpRequest can get you exactly what you want.
Manas Bhardwaj 19-Jun-12 6:30am    
Good links +5!
Sandeep Mewara 19-Jun-12 11:08am    
Thanks.
Sergey Alexandrovich Kryukov 19-Jun-12 10:04am    
The question is not clear, so it may or may not be about parsing. What is "load", "get contents"?
Anyway, the links provide good overview, my 5.
--SA
 
Share this answer
 
Comments
Manas Bhardwaj 19-Jun-12 6:30am    
my 5!
Prasad_Kulkarni 19-Jun-12 8:34am    
Thank you Manas!
Sergey Alexandrovich Kryukov 19-Jun-12 10:02am    
Useful links, a 5.
--SA
Prasad_Kulkarni 19-Jun-12 23:58pm    
:) Thank you SA!

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