0

I am trying to learn AJAX, and I am referring to online material and some books. I came to know that AJAX isn't a new technology as such, however, it is a way of using existing technologies for "faster" web-applications (or changing some part of the web-page without refreshing the whole page).

Most of the code which I have seen in regards to AJAX, they are at client side (HTML, CSS and JavaScript). But how do I create a simple AJAX based web-application? I need something at the server side?

Can I used Apache Tomcat (and a servlet deployed) and URL mapping to fulfil a request initiated by a web-browser? Most of the books which I have seen, they haven't mentioned anything for what to do at server side, they talk only about the client side.

Can anyone help me how to approach in this regards?

CuriousMind
  • 8,301
  • 22
  • 65
  • 134

1 Answers1

0

Ajax is for posting data to different server side APIs. We invoke server's API using our data, and server echoes its output back to us. On basis of the response, you modify the HTML or CSS. It is a client side thing, and which is the reason most books talk about only client side. Now when, it comes to server's response, it can be in xml, plain text or json(quite popular).

I guess, your servlets can be invoked in this way using AJAX. you can output data in json or xml format from servlets. That data comes to client side and then parsed using js or jquery(Whatever is you favourite)

How to use Servlets and Ajax? can be a good resource for reference

Community
  • 1
  • 1
Yogesh Kumar Gupta
  • 1,009
  • 1
  • 10
  • 10