0% found this document useful (0 votes)
83 views13 pages

Computer Science S-75: Building Dynamic Websites

This document is a lecture on Ajax from a computer science course. It discusses DOM manipulation, XMLHttpRequest methods for asynchronous HTTP requests, content types like HTML, XML and JSON, and using PHP and JSON to retrieve and parse data. It also briefly mentions Ajax loading indicators and the jQuery ajax method, and provides examples of sites using Ajax like bart.gov.

Uploaded by

samyakmehta1234
Copyright
© Attribution Non-Commercial (BY-NC)
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)
83 views13 pages

Computer Science S-75: Building Dynamic Websites

This document is a lecture on Ajax from a computer science course. It discusses DOM manipulation, XMLHttpRequest methods for asynchronous HTTP requests, content types like HTML, XML and JSON, and using PHP and JSON to retrieve and parse data. It also briefly mentions Ajax loading indicators and the jQuery ajax method, and provides examples of sites using Ajax like bart.gov.

Uploaded by

samyakmehta1234
Copyright
© Attribution Non-Commercial (BY-NC)
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

Computer Science S-75

Building Dynamic Websites


Harvard Summer School
https://www.cs75.net/

Lecture 7: Ajax
David J. Malan [email protected]
0

DOM
<!DOCTYPE html> <html> <head> <title>My title</title> </head> <body> <a href="">My link</a> <h1>My header</h1> </html>

DOM
<!DOCTYPE html> <html> <head> <title>My title</title> </head> <body> <a href="">My link</a> <h1>My header</h1> </html>

Image from http://www.w3schools.com/htmldom/.

Ajax

source unknown

XMLHttpRequest

abort() getAllResponseHeaders() getResponseHeader(header) open(method, url) open(method, url, async) open(method, url, async, user) open(method, url, async, user, password) send() send(data) setRequestHeader(header, value)

XMLHttpRequest

onreadystatechange readyState

0 (unitialized) 1 (open) 2 (sent) 3 (receiving) 4 (loaded)

responseBody responseText responseXML status


200 (OK) 404 (Not Found) 500 (Internal Server Error) ...

statusText
5

Content Types

HTML (text/html) XML (text/xml) JSON (application/json)

JSON

Table from http://www.json.org/.

PHP + JSON

json_encode($value)
http://us3.php.net/manual/en/function.json-encode.php

eval(string)
http://www.json.org/js.html

Progress...

Ajax loading gif generator http://www.ajaxload.info/ AJAX Activity indicators http://mentalized.net/activity-indicators/ ...

jQuery.ajax()
http://api.jquery.com/jQuery.ajax/

10

bart.gov

11

Computer Science S-75


Building Dynamic Websites
Harvard Summer School
https://www.cs75.net/

Lecture 7: Ajax
David J. Malan [email protected]
12

You might also like