javascript relative path to load xml file

Discussion in 'Software' started by torontodesi, Feb 25, 2009.

  1. torontodesi

    torontodesi

    Joined:
    Feb 25, 2009
    Messages:
    2
    The file/folder structure is like

    root/one/index.htm
    root/one/files/images/picture.jpg

    root/two/index.htm
    root/two/files/images/pict888.jpg

    root/shared/files/js/test1.js
    root/shared/files/xml/datafile.xml ​

    .
    .
    The index.htm files in folder one and two has reference to .js file -----

    <script src="../shared/files/js/test1.js" type="text/javascript"></script>​


    in head section. That is simple.

    .

    Now the .js file has code to open xml file as follows:


    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async=false;
    xmlDoc.load("path");

    QUESTION 1 what this path could be?
    .
    .
    .
    .
    there are pictures on index.htm in one and two which come from respective files/images folders, but their path is obtained from .xml file
    <row1 id="1" imageurl="imagepath" rowtitle="title">desctiption test</resrow>
    QUESTION 2 what this imagepath could be?
    .
    .
    .
    QUESTION 3 For the above file/folder structure do path and imagepath change depending its on location - local machine or web server?



    Thanks
     
    torontodesi, Feb 25, 2009
    #1
    1. Advertising

  2. torontodesi

    susith

    Joined:
    Feb 25, 2009
    Messages:
    16
    JavaScript are executing on web browser. So all paths should access outside (web browser) and relative to web server.

    I assume you can reach index.htm from localhost/one/index.htm

    1. So you must put relative path from there files/xml/datafile.xml
    and xml file should accessible from localhost/one/files/xml/datafile.xml

    2 as same as above files/images/picture.jpg

    3. relative to web server (webapp)
     
    susith, Feb 26, 2009
    #2
    1. Advertising

  3. torontodesi

    torontodesi

    Joined:
    Feb 25, 2009
    Messages:
    2
    Thanks....
     
    torontodesi, Feb 26, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DW
    Replies:
    7
    Views:
    26,083
    lbellysmit
    Jan 3, 2011
  2. Shane

    To Javascript, or not to Javascript

    Shane, Aug 29, 2005, in forum: NZ Computing
    Replies:
    5
    Views:
    473
    Waylon Kenning
    Aug 30, 2005
  3. univbgp102@gmail.com
    Replies:
    1
    Views:
    411
    gnu / linux
    May 22, 2008
  4. univbgp102@gmail.com
    Replies:
    0
    Views:
    531
    univbgp102@gmail.com
    May 20, 2008
  5. Dhanabal
    Replies:
    0
    Views:
    384
    Dhanabal
    May 28, 2008
Loading...

Share This Page