• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Question about how XML and XPath works on client side ?

 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An XML document is on the server. Now this document is placed in the javascript code. When request comes for the page containing this javascript code, this script is loaded in the HTML page and sent to the requesting client. Until this time javascript is not executed and XML page is not loaded. Now on client machine, this javascript is executed but XML page that this javascript tries to load is on the server machine. So how will this page be loaded like in this script?

".
.
.
xmlDoc.async=false;
xmlDoc.load(fname);
return(xmlDoc);
}

xml=loadXMLDoc("books.xml");
path="/bookstore/book/title"
.
.
. "
Will the javascript make remote server call , when it executes "xml=loadXMLDoc("books.xml")" ? or does the page get loaded before being sent to browser ? If thats the case, then how does the javascript get executed on server, if entire script inside script tag is executed on client browser ?
So its like, if anything in between <script /> tags is executed strictly on the client browser, then hoo does page get loaded which is on server when script is being executed on client browser ? If the javascript code is executed on the server before being sent to browser, then does it mean that javascript code is not strictly meant for being executed on browser ?

This is confusing me.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It makes a call to the server. Use a tool such as Fiddler to see the HTTP call.

Eric
 
jignesh soni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.
How does "loadXMLDoc("books.xml")" make remote server call ? There is no mention of ip address or hostname in the argument list ? Doesnt a server call need ip address or hostname to make remote remote server call ?
If the javascript is making remote server call, then can it make this remote server call to any server apart from the server hosting website ?

 
Create symphonies in seed and soil. For this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!