Take the 2-minute tour ×

I'm new to XML and I want to learn how to parse XML with jQuery. I've followed this example http://www.vagrantradio.com/2009/10/how-to-parse-xml-using-jquery-and-ajax.html, and I even downloaded the demo, but it didn't work on my computer.

However, when I uploaded the demo to a remote server, everything worked fine. So my question is, is there a way to parse a XML with jQuery on a local computer? I'm asking this because it's a lot simpler for me to practice XML without constantly uploading files to remote sever. As for the local testing, I've tried using the WAMP server but with no luck, so is there a way to text XML parsing with jQuery on my local computer without uploading to the remote server?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Depending on the browser you use, you can run into some security features that prevent you from using File API/XHR on the file:// protocol (I had the problem with Chrome).

How are you loading the xml file?

A simple solution would be to use a simple http server, with python for exemple:

python -m SimpleHTTPServer 8000
share|improve this answer
I'm using Chrome as well, but I'm experiencing the same problems, how do you change those security features? –  Mentalhead Mar 12 '11 at 15:55
you can start chrome with a command line argument: --allow-file-access-from-files (make sure you close all chrome instances before launching with that option) –  Guillaume86 Mar 12 '11 at 16:15
You can allow file access by starting Chrome with the --allow-file-access-from-files command line option. See here –  Andomar Mar 12 '11 at 16:17
@Guillaume86 I've accepted your answer, because after adding this line everything works well. Can you use this line in other browsers such as IE, FF and Opera? –  Mentalhead Mar 12 '11 at 17:19
it's browser specific, i'm pretty sure there's equivalent options for the other browsers (in IE it's just a warning alert to accept). –  Guillaume86 Mar 12 '11 at 17:22

You could use jsfiddle.net. Personally I use it to write and test quick javascript prototypes because all I need is a web browser. It also allows you to test AJAX requests. Here's one demo I wrote for you that you could enhance.

share|improve this answer
Your idea sounds good, but I would prefer if I could do the jQuery and the testing in my default coding program. –  Mentalhead Mar 12 '11 at 15:56

When you're viewing a web page from the local filesystem, make sure your refs are correct. For example:


Should probably be changed to:


An absolute URL should always work, like:

share|improve this answer
I've checked the path several times, and it's ok. In addition, I downloaded the demo that works on a remote host but not on my local, so I'm positive that path is correct. –  Mentalhead Mar 12 '11 at 16:04
Mentalhead: Paths can be different between a remote host and a local filesystem. For example, if you run Windows, a / is not a valid path separator; you'd need \ –  Andomar Mar 12 '11 at 16:17

Your Answer


