AJAX Basics - PowerPoint PPT Presentation

1 / 5
About This Presentation
Title:

AJAX Basics

Description:

Alok Chandra. CS 142 Lecture Notes: Ajax. Slide 3. Higher-Level AJAX Example ... Alok Chandra. CS 142 Lecture Notes: Ajax. Slide 4. JSON Example {name: 'Alice' ... – PowerPoint PPT presentation

Number of Views:77
Avg rating:3.0/5.0
Slides: 6
Provided by: johnous
Category:
Tags: ajax | alok | basics

less

Transcript and Presenter's Notes

Title: AJAX Basics


1
AJAX Basics
xhr new XMLHttpRequest() xhr.onreadystatechange
xhrHandler xhr.open("POST",
url) xhr.send(postData) ... function
xhrHandler() if (this.readyState ! 4)
return if (this.status ! 200) //
Handle error ... return ... var
text this.responseText var document
this.responseXML
State 4 means done
Response available as raw text or XML
2
JSON Example
name "Alice", gpa 3.5, friends "Bill",
"Carol", "David"
3
Higher-Level AJAX Example
lt form.text_field(userName) gt ... ltdiv
id"completionMenu"gt...lt/divgt ... lt
observe_field( form_userName, frequency
gt 0.25, update gt
"completionMenu", url gt action
gt "nameChoices" ) gt class FooController lt
ApplicationController def nameChoices
... end
4
Higher-Level AJAX Example
lt form.text_field(userName) gt ... ltdiv
id"completionMenu"gt...lt/divgt ... lt
observe_field( form_userName, frequency
gt 0.25, update gt
"completionMenu", url gt action
gt "nameChoices" ) gt class FooController lt
ApplicationController def nameChoices
... end
5
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com