0

i have to read a server side xml file using javascript or jquery or Ajax, if anyone have any idea regarding the same then please guide me.

1 Answer 1

1

I would recommend this jQuery Plugin: http://www.fyneworks.com/jquery/xml-to-json/

Here's an example of how to get the xml-data and using the plugin above to convert the xml to json:

$.get('http://example.com/data.xml', function(xml) {
  var json = $.xml2json(xml);
  console.log(json);
});

In the json variable now lies your parsed xml-data.

Let's use this xml data for the sample:

'<xml><user>fan</user></xml>';

alert(json.user) would display "fan".

Hope I could help you out.

Greetings.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.