Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

AJAX Technology notes

Prepared By:Mrs.Bijal
Thaker(Asst.Prof, MUCC)
Ajax is Asynchronous JavaScript
and XML
It is not a programming language but
a technique to make a page
interactive.
About AJAX

Ajax is not a programming language or a tool,


but a concept == the use
of XmlHttpRequest objects to interact with a
web server dynamically via JavaScript.
General concept
AJAX is not a programming language it is a
combination of XHTML, JavaScript and XML
which is used for creating web applications.
Q. What is Ajax?
• Ajax is a client-side script that communicates
with (to and from) server without refresh the
complete page. You can also say "the method
of exchanging data with a server, and
updating parts of a web page without
reloading the entire page". Ajax is used in all
web-technology like PHP, ASP,
Java and Mobile Technology etc.
Q.. How we can send data to server using
Ajax?
GET / POST
Q. Where Ajax is used?
Ajax can be used to get the data from Server
when you don't want to refresh the page e.g.

• In Registration page, check username and email


address is already taken OR NOT.
• In Product Listing page, when user click on
"Next" under pagination, you won't want to
show the next page data without refreshing the
page.
Q. How AJAX works?
Q. What is XMLHttpRequest?
XMLHttpRequest is an API available to web
browser scripting languages (i.e. JavaScript).
It is used to send HTTP/HTTPS requests to a
web server and load the server's response into
the script.

(Ajax callback)
Q. What do the different readystates in
XMLHttpRequest?
0 Ajax Request not initialized 
1 Ajax Request's server connection established
2 Ajax Request received 
3 Ajax Request processing 
4 request finished and response is ready.
Q. Diff between synchronous and
asynchronous request
• synchronous: user must wait while new pages
load the typical communication pattern used
in web pages (click, wait, refresh=event
handler)
• Asynchronous : (process will be carried out in
the background) user don’t need to wait, user
can keep interacting with page while data
loads
Q. Advantage of AJax?
• Its faster as it load only required content.
• More user friendly.
• Reduce the loading of page.
• Increases speed.
Q. What type of response we can get in Ajax
Response?
• text data
• html data
• JSON data
• XML data
Property description
Status the request's HTTP error
code (200 = OK)
statusText HTTP error code text
responseText the entire text of the
fetched file, as a String
responseXML the entire contents of the
fetched file, as a DOM tree
Q.How to use Ajax in JavaScript program

Syntax for creating XmlhttpRequest object


variable = new XMLHttpRequest();

Example:
var xhttp=new XMLHttpRequest();
Ajax is used with combination of
following technologies:

Css
JavaScript
DOM
Xmlhttprequest

You might also like