0% found this document useful (0 votes)
7 views

Lect Ajax

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Lect Ajax

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

1 jQuery Ajax

Abdul Rochman
Synchronous web communication
2

 synchronous: user must wait while new pages load


 the typical communication pattern used in web pages
(click, wait, refresh)
Web applications and Ajax
3

 web application: a dynamic web site that mimics


the feel of a desktop app
 presents a continuous user experience rather than
disjoint pages
 examples: Gmail, Google Maps, Google Docs and
Spreadsheets, Flickr, A9
Web applications and Ajax
4

 Ajax: Asynchronous JavaScript and XML


 not a programming language; a particular way of
using JavaScript
 downloads data from a server in the background

 allows dynamically updating a page without making


the user wait
 avoids the "click-wait-refresh" pattern

 Example: Google Suggest


Asynchronous web communication
5

 asynchronous: user can keep interacting with page


while data loads
 communication pattern made possible by Ajax
A typical Ajax request
6

1. user clicks, invoking an event handler


2. handler's code creates an XMLHttpRequest
object
3. XMLHttpRequest object requests page from
server
4. server retrieves appropriate data, sends it back
5. XMLHttpRequest fires an event when data arrives
 this
is often called a callback
 you can attach a handler function to this event

6. your callback event handler processes the data


and displays it
How AJAX Works
7
How AJAX Works
8
How AJAX Works
9

CS380
XMLHttpRequest Object (Method)
10
XMLHttpRequest Object(Method)
11
XMLHttpRequest Object (Properties)
12
XMLHttpRequest Object (Properties)
13
Contoh
14
Contoh
15

ajax_info.txt
<h1>AJAX</h1>
<p>AJAX is not a programming language.</p>
<p>AJAX is a technique for accessing web servers from a web page.</p>
<p>AJAX stands for Asynchronous JavaScript And XML.</p>
Link
16

 https://www.w3schools.com/xml/ajax_intro.asp
 https://www.w3schools.com/jquery/jquery_ajax_in
tro.asp

You might also like