Running Tomcat 5.5.23/Firefox 4.0 with Firebug. I've a very simple problem and it's beyond perplexing at this point. I've a static html page that I open (as in File -> Open) using the browser (it's not even behind a web server). That static html file looks like below:
I've the following servlet running at port 80 (Tomcat).
When I click the button on html page, I can see the ajax request being sent using the Firebug (XHR panel). I get a Http 200 status, the response size seems in line with the string being printed... the Ajax call is successful!, because it executes the success: function. however.. here's the kicker!.. the "data" field is empty.. the alert box in the success function alert nothing I was hoping to see"<h3>foobar</h3>"..
I had the ajax url as "http://localhost", but that extra DNS lookup slows me down by 7 ms.
Also there don't seem to be any http proxy/networking issues. The request is getting to the servlet.
The servlet itself works fine (in the browser.. http://localhost prints "foobar")
What gives? This seems like jquery-servlet 101 stuff.. am I missing something...?
Joined: Jun 10, 2011
It looks like the problem was that the html snippet that I opened as a File in a browser.. needs to be actually be served up behind a webserver for the Ajax response to be handled.