AJAX Technology
•AJAX stands for
Asynchronous Java script And Xml
AJAX is not a new language , rather it is a new style of programming made
popular by Google
in 2007 and today it is the backbone of
every dynamic web application
Need of AJAX:
When java script was released , it was able to interact with html but it had no way of communicating with the server.
Thus
, the only way html page could communicate with a server side script like php
or jsp was
to make html form containing a
submit button and generating get or post
request
• when the user clicks submit
button a new page is generated by the server containing the desired results
•But , sometimes on slow networks this
could take time .
•Moreover most of the time the new page has 90% elements same as the previous page only 10% of data gets changed.
Exercise of AJAX:
•Write an AJAX based application to
get the date from server and display it on the page.
Example:-
<%@
page import="java.util.*,java.text.*" %>
<%
Date
today=new Date();
SimpleDateFormat sdf=new SimpleDateFormat("dd-MMM-yyyy");
String
str=sdf.format(today);
%>
<h3>Date at server is <%= str %></h3>