I'm very new to Javascript, so if I come across as completely clueless, I apologize in advance...

I want to create a demo in which I want to have a web page that connects to a server and then present the data from that server on the web page.

I created a simple Java server that I have running locally (either in JBoss or Jetty) on port 8080.

Now to read data from the server I use the following snippet:

xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET", "http://localhost:8080/simpleTest", false);
try {
} catch(err){
A few remarks:
  • The server works, when I put the URL in a web browser I get the result I expect
  • There's no problem with the XML. I've downloaded it and stored it in a local file. When I replace the URL in the xmlhttp.open command with the name of the local file, everything works fine
  • The error that is printed to the screen from the 'catch' is: undefined

I have no idea what I'm doing wrong. If anybody can help me out or point out ways to investigate this further I would appreciate it very much.