Está en la página 1de 13

AJAX

Beginner Level
OUTLINE
▪ Developer Essentials
▪ Understanding DOM & XML
▪ Understanding XML-HTTP request
▪ Previewing Links with AJAX
▪ Creating Dynamic Forms
▪ Understanding AJAX Frameworks
WHAT IS AJAX?
▪ AJAX known as “Asynchronous JavaScript And XML“

▪ AJAX is a set of Web development techniques using many Web


technologies on the client side to create asynchronous Web applications.

▪ Update a web page without reloading the page


▪ Request data from a server - after the page has loaded
▪ Receive data from a server - after the page has loaded
▪ Send data to a server - in the background
HOW AJAX WORKS?
DEVELOPMENT TOOLKIT
▪ Text editor (Visual code studio)
▪ Web browser (Google Chrome)
▪ Web server (Apache)
▪ HTML + CSS + JavaScript
DEVELOPMENT TOOLKIT
▪ Text editor (Visual code studio)
▪ Web browser (Google Chrome)
▪ Web server (Apache)
▪ HTML + CSS + JavaScript
XMLHTTPREQUEST OBJECT
The keystone of AJAX is the XMLHttpRequest object.
▪ The XMLHttpRequest object can be used to exchange data with a server
behind the scenes. This means that it is possible to update parts of a web
page, without reloading the whole page.
▪ Onreadystatechange: Defines a function to be called when the readyState
property changes

Property Description
readyState Holds the status of the XMLHttpRequest
responseText Returns the response data as a string
responseXML Returns the response data as XML data
status Returns the status-number of a request
statusText Returns the status-text (e.g. "OK" or "Not Found")
XMLHTTPREQUEST OBJECT
readyState
Value Definition
0 Uninitialized
Object contain no data
1 Loading
Object is currently loading its data
2 Loaded
Object has finished loading its data
3 Interactive
User may interact with object even though its not fully loaded
XMLHTTPREQUEST OBJECT METHODS
▪ abort()
▪ getAllResponseHeaders()
▪ getResponseHeader()
▪ Open()
▪ send()
XMLHTTPREQUEST OBJECT
status
Value Definition
200 OK
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not found
500 Internal Server Error
PREVIEWING LINKS WITH AJAX
CREATING DYNAMIC FORMS

También podría gustarte