Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Mar 2012
    Thanked 0 Times in 0 Posts

    Servlet + Ajax woes. XML doc returned from servlet not working for ajax code.

    I have a servlet that reads data out of a text file and sends that data as an xml page. The servlet is hosted on http://localhost:8080/Checkers/CheckersServlet. I made it in Eclipse IDE for Java EE and host it on a Tomcat server. I can open that url in firefox and it loads the xml fine. How do I call on the servlet from the ajax code. Do I write something like

    var req = new XMLHttpRequest();
    		req.onreadystatechange = function()
    			if(req.readyState == 4)
    		var url = "http://localhost:8080/Checkers/CheckersServlet";	
    where displayResult(req) is a custom function that does what I want with the xml received from the servlet? This is the code I am trying to use but it isn't working, and I've confirmed the reason is that I am not getting any xml from the servlet.
    Last edited by Adam1942; 03-12-2012 at 07:38 PM. Reason: Focusing in on the problem


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts