Computer Science E-75 Building Dynamic Websites Harvard Extension School http://www.cs75.net/

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

DOM My title My link

My header



1

DOM My title My link

My header



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

2

DOM „

HTML DOM Reference http://www.w3schools.com/htmldom/dom_reference.asp

„

DOM (Document Object Model) Reference http://www.javascriptkit.com/domref/

„

DOM objects and methods http://www.howtocreate.co.uk/tutorials/javascript/domstructure

3

XMLHttpRequest „

„

„

XMLHttpRequest Object Microsoft Developer Network http://msdn2.microsoft.com/en-us/library/ms535874(VS.85).aspx XMLHttpRequest Mozilla Developer Center http://developer.mozilla.org/en/docs/XMLHttpRequest The XMLHttpRequest Object World Wide Web Consortium http://www.w3.org/TR/XMLHttpRequest/

4

Methods „ „ „ „ „ „ „ „ „ „

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)

5

Properties „ „

onreadystatechange readyState … … … … …

„ „ „ „

responseBody responseText responseXML status … … … …

„

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

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

statusText 6

Content Types „ „ „

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

http://www.quirksmode.org/blog/archives/2005/12/the_ajax_respon.html

7

JSON

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

8

PHP + JSON „

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

„

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

9

Progress... „ „ „

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

http://ajaxpatterns.org/Progress_Indicator

10

YUI Connection Manager http://developer.yahoo.com/yui/connection/

11

Computer Science E-75 Building Dynamic Websites Harvard Extension School http://www.cs75.net/

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

Computer Science E-75 - The Open Academy

Computer Science E-75. Building Dynamic Websites. Harvard Extension School http://www.cs75.net/. Lecture 9: Ajax. David J. Malan [email protected] ...

47KB Sizes 2 Downloads 233 Views

Recommend Documents

Computer Science E-75 - The Open Academy
Harvard Extension School http://www.cs75.net/. Lecture 7: JavaScript ... CDATA[. // put cursor in username field if empty ... else put cursor in password field else.

Computer Science E-75 - The Open Academy
9. PHP + JSON. ▫ json_encode($value) http://us3.php.net/manual/en/function.json-encode.php. ▫ eval(string) http://www.json.org/js.html ...

Computer Science 75 Fall 2009 Scribe Notes ... - The Open Academy
One disadvan- tage of the JavaScript is that you have no way of logging how users are interacting with your search box because no information is being sent to your server. • Which approach might we want to take if we were developing for a mobile de

Computer Science E-1 Spring 2010 Scribe ... - The Open Academy
We'll soon make a tool available via web or e-mail that will allow you ... address bar. http://www.cnn.com:80/ will take us to CNN's homepage as usual. • If you'd ...

README.txt 1/2 - The Open Academy
8: In these directories are two client-server pairs, one that ... http://www.ammai.com/modules.php?op=modload&name=Sections&file=index&req=viewarticle.

AttributeConverter1.xsl 1/2 - The Open Academy
AttributeConverter1.xsl. 1/2 examples5/. 1: 2:

README.txt 1/2 - The Open Academy
27: TaxService port = service.getTaxService();. 28: 29: // Make the actual calls to the three methods. 30: double taxpercent = port.calcTaxRate(21.00, 23.10);. 31:.

anchor.svg 1/1 - The Open Academy
9: This is CSCI E-259. ...... 4Y,i2c2Td>E+"ZS1D[5Z+XDmn@md9I^'JbRMH"cJ-'e@on .... 44: .

SAXDemo2.java 1/2 - The Open Academy
61: * @param uri namespace. 62: * @param localName name of element, sans namespace. 63: * @param qName name of element, with namespace. 64: * @param attributes element's collection of attributes. 65: *. 66: * @throws SAXException general SAX error or

The Future of Computer Science - Cornell Computer Science
(Cornell University, Ithaca NY 14853, USA). Abstract ... Where should I go to college? ... search engine will provide a list of automobiles ranked according to the preferences, .... Rather, members of a community, such as a computer science.

INDIAN NATIONAL SCIENCE ACADEMY Bahadur ...
NAME OF THE CONFERENCE. DATES. VENUE. PLACE & ... Name of applicant Dr./Prof. (in Capital letters). (b) .... (c) Actual registration fee: Exempted/not ...

INDIAN NATIONAL SCIENCE ACADEMY Bahadur ...
provided for training programmes / courses/ joining post doctoral Fellowship ... Philosophy of Science, (9) Theoretical and Applied Mechanics, (10). Nutritional ...

The Leonia Academy for Science Teacher Recommendation Formre ...
2) Please evaluate the above named student in the following areas (Check). Low. 1. Average. 2. Above. Average. 3. High. 4. Superior. 5. Work ethic. Quality of work. Willingness to accept a challenge. Problem-solving ability. Attention to details. Eff

The Leonia Academy of Science Parent Release Form.pdf ...
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. The Leonia ...

Computer Science E-259 Lectures - Computer Science E-259: XML ...
Sep 17, 2007 - most important new technology development of the last two years." Michael Vizard ... applications: what are the tools and technologies necessary to put ... XML. When. ▫ The World Wide Web Consortium (W3C) formed an XML.

Computer Science E-259
Jan 7, 2008 - Yahoo! UI Library http://developer.yahoo.com/yui/ ..... how to program in JavaScript and PHP, how to configure. Apache and MySQL, how to ...

Computer Science E-259
Nov 19, 2007 - labeling the information content of diverse data sources .... .... ELEMENT article (url, headline_text, source, media_type, cluster,.

TEXTS IN COMPUTER SCIENCE
Java — Designed as a language to support mobile programs, Java has special .... We offer a few low-level coding hints that are helpful in building quality programs. ...... cheap in selecting your table size or else you will pay the price later.

Computer Science E-259
Oct 1, 2007 - DOCTYPE students SYSTEM "student.dtd">.

Computer Science E-259
Nov 29, 2007 - these foundations, the course will explore in detail a number of case studies that utilize XML in e-business: e-commerce, web personalization, ...

Computer Science E-259
Oct 1, 2007 - By Definition. ▫ The result of parsing a document with a DOM parser is a. DOM tree that matches the structure of that document. ▫ After parsing is ...