Jump to content

Read in xml file

Recommended Posts

I want to setup a javascript page on my website where I have a xml file that has a name comment and gps coordinates. The user types in the name and and it searches the xml file and spits out the comment and coordinates.  My main question is where can I upload file for my page to search and how( what path do I use to read it in)

Link to comment
  • Replies 2
  • Created
  • Last Reply

So this is my code if I use the path  "/s/cd_catalog.xml" or  "cd_catalog.xml" I get a status of 404

If I use  "s/cd_catalog.xml" I get a status of 0 which doesn't make sense


<button type="button" onclick="loadXMLDoc()">Get my CD collection</button>
<table id="demo"></table>

function loadXMLDoc() 
  var xmlhttp = new XMLHttpRequest();
  xmlhttp.onreadystatechange = function()
  var table=this.status;
  document.getElementById("demo").innerHTML = table;
  xmlhttp.open("GET", "s/cd_catalog.xml", true);



Link to comment


This topic is now archived and is closed to further replies.

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.