How do I display this XML document?

In javascript,  element = document.getElementById(id); if I want to access some values from XML(or similar) document, can I change the document value in above code to that particular document and not the current document?

  • Answer:

    So you want javascript to change something in a different document than the one it's loaded in? You can't. JavaScript is client-side - and unless you serve that client a document with javascript, it can't do that. document is the currently loaded document in the browser and is the highest scope (apart from window). You might want to learn more about what JavaScript actually does.

Giordon Stark at Quora Visit the source

Was this solution helpful to you?

Other answers

Load the JSON/XML document using ajax in JS and you can then parse it and put the element equal to the required parsed value.

Bhanu Pratap

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.