AJAX Robin Burke ECT 360.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Introduction to Ajax.
Advertisements

9. AJAX & RIA. 2 Motto: O! call back yesterday, bid time return. — William Shakespeare.
1 Cleaning up the Internet Using AJAX, SOAP and Comet CS526 Mike Gerschefske Justin Gray James Yoo 02 May 2006.
19-Jun-15 Ajax. The hype Ajax (sometimes capitalized as AJAX) stands for Asynchronous JavaScript And XML Ajax is a technique for creating “better, faster,
AJAX asynchronous server-client communication. Test.
Cloud Computing Lecture #7 Introduction to Ajax Jimmy Lin The iSchool University of Maryland Wednesday, October 15, 2008 This work is licensed under a.
Does Ajax suck? CS575 Spring 2007 Chanwit Suebsureekul.
5/3/2006 Mike/Justin/JYoo AJAX/SOAP/Comet 1 Cleaning up the Internet Using AJAX, SOAP and Comet CS526 Mike Gerschefske Justin Gray James Yoo 02 May 2006.
Interactive Web Application with AJAX
Introduction to AJAX AJAX Keywords: JavaScript and XML
Ajax (Asynchronous JavaScript and XML). AJAX  Enable asynchronous communication between a web client and a server.  A client is not blocked when an.
JavaScript & jQuery the missing manual Chapter 11
CSCI 6962: Server-side Design and Programming Introduction to AJAX.
Lecture 12 – AJAX SFDV3011 – Advanced Web Development Reference: 1.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
JavaScript II ECT 270 Robin Burke. Outline JavaScript review Processing Syntax Events and event handling Form validation.
06/10/2015AJAX 1. 2 Introduction All material from AJAX – what is it? Traditional web pages and operation Examples of AJAX use Creating.
XMLHttpRequest Object When Microsoft Internet Explorer 5.0 introduced a rudimentary level of XML support, an ActiveX library called MSXML was also introduced,
Lecture # 6 Forms, Widgets and Event Handling. Today Questions: From notes/reading/life? Share Personal Web Page (if not too personal) 1.Introduce: How.
Client Side Programming with JavaScript Why use client side programming? Web sides built on CGI programs can rapidly become overly complicated to maintain,
Lecture 9: AJAX, Javascript review..  AJAX  Synchronous vs. asynchronous browsing.  Refreshing only “part of a page” from a URL.  Frameworks: Prototype,
AJAX محمد احمدی نیا 2 Of 27 What is AJAX?  AJAX = Asynchronous JavaScript and XML.  AJAX is not a new programming language, but.
AJAX Compiled from “AJAX Programming” [Sang Shin] (Asynchronous JavaScript and XML)
Fall 2006 Florida Atlantic University Department of Computer Science & Engineering COP 4814 – Web Services Dr. Roy Levow Part 2 – Ajax Fundamentals.
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
Web Technology Introduction AJAXAJAX. AJAX Outline  What is AJAX?  Benefits  Real world examples  How it works  Code review  Samples.
CISC 3140 (CIS 20.2) Design & Implementation of Software Application II Instructor : M. Meyer Address: Course Page:
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Web Technologies Lecture 7 Synchronous vs. asynchronous.
AJAX Asynchronous JavaScript and XML 1. AJAX Outline What is AJAX? Benefits Real world examples How it works 2.
SE-2840 Dr. Mark L. Hornick 1 Introduction to Ajax Asynchronous Javascript And XML.
AJAX. Overview of Ajax Ajax is not an API or a programming language Ajax aims to provide more responsive web applications In normal request/response HTTP.
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
JavaScript II ECT 270 Robin Burke. Outline Functions Events and event handling Form validation.
What is AJAX ? Asynchronous Javascript and XML. Not a stand-alone language or technology. It is a technique that combines a set of known technologies in.
AJAX – Asynchronous JavaScript And XML By Kranthi Kiran Nuthi CIS 764 Kansas State University.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
 AJAX technology  Rich User Experience  Characteristics  Real live examples  JavaScript and AJAX  Web application workflow model – synchronous vs.
AJAX CS456 Fall Examples Where is AJAX used? Why do we care?
JavaScript and Ajax Week 10 Web site:
CITA 330 Section 10 Web Remoting Techniques. Web Remoting Web Remoting is a term used to categorize the technique of using JavaScript to directly make.
NCCUCS 軟體工程概論 Lecture 5: Ajax, Mashups April 29, 2014.
AJAX. Objectives Understand and apply AJAX Using AJAX in DOJO library.
Ajax SUBMITTED BY NITIN RAMANI C.S.E 3 rd Y 5 th S R.N CS SUBMITTED TO PRO. PUSHPARAJ PATEL SIR.
Ajax & Client-side Dynamic Web Gunwoo Park (Undergraduate)
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
Introduction to AJAX Pat Morin COMP Outline What is AJAX? – History – Uses – Pros and Cons An XML HTTP Transaction – Creating an XMLHTTPRequest.
What is AJAX ? Asynchronous Javascript and XML.
JavaScript and Ajax (Ajax Tutorial)
CSE 154 Lecture 11: AJAx.
Not a Language but a series of techniques
AJAX AJAX = Asynchronous JavaScript and XML.
CS 371 Web Application Programming
Data Virtualization Tutorial… CORS and CIS
AJAX and REST.
XMLHttp Object.
AJAX.
AJAX.
Web System & Technology
CSE 154 Lecture 11: AJAx.
CSE 154 Lecture 22: AJAX.
ISC440: Web Programming 2 AJAX
JavaScript & jQuery AJAX.
Chengyu Sun California State University, Los Angeles
AJAX CS-422 Dick Steflik.
Intro to Ajax Fred Stluka Jan 25, 2006.
DR. JOHN ABRAHAM PROFESSOR UTPA
Chengyu Sun California State University, Los Angeles
Chengyu Sun California State University, Los Angeles
Presentation transcript:

AJAX Robin Burke ECT 360

Outline Admin Final Project AJAX AJAX lab

Homework #5 Due Wednesday Questions?

Examples Business card maker Google Select http://www.baekdal.com/articles/Usability/usable-XMLHttpRequest/ Google Select http://www.google.com/webhp?complete=1&hl=en

Application model from http://www.adaptivepath.com/publications/essays/archives/000385.php

What we need Client-side code that can respond to user interface actions (without loading new pages) Client-side code that can formulate requests to a web application A web application that can receive requests and deliver data in XML form Client-side code that can receive XML data and update the user interface

Why is XML important? Not essential possible to implement this pattern with XML but It is designed for data interchange HTML isn't a good fit The client can process it XML parser built into every modern browser Most back-end servers can produce XML for many it will be a basic building block

Responding to user actions JavaScript code to handle user interface actions very standard JavaScript event handling code Use standard HTML form controls Associate function calls with onChange, onClick, onMouseOver, etc. We should all know how to do this

Formulating requests We want to send a request to the web server not for an HTML page, but for an XML document Special object XMLHttpRequest present in IE and other browsers

Achieving asynchrony Distributed systems problem A request goes from client to server The server will take some unknown amount of time to respond How to handle this? With a standard web application the user just waits for the new page to load but no new page is loaded with an AJAX application

Acheiving asynchrony II Recall xmlDoc.async="false"; Makes the JS code wait for the parser to complete synchronous interaction ensures that the document is there when the next line of code executes What happens if async = true?

Achieving asynchrony III A call to "load" will return right away but there is no XML document JavaScript can go on handling user interaction How to know when the document is there?

Achieving asynchrony Three possibilities polling timed polling check continuously until the document arrives "busy waiting" wastes a lot of processor resources timed polling check periodically a bit better but we don't react right away best option the "callback"

Callback "Don't call us, we'll call you." Instead of waiting create a "callback" function associate it with the event we're interested in document loading when the document is loaded function is called now we can process the document

Code outline Data received from form input XMLHttpRequest created Callback function set XMLHttpRequest sent When callback function is called, update page

Details IE only Request Set onReadyStateChange property Mozilla details in examples differences very minor Request ActiveXObject Microsoft.XMLHTTP Set onReadyStateChange property this is the callback function Call open method with HTTP method, url, and async flag Call send method actually transmits request to the server

onReadyStateChange Called every time the "ready state" of the document changes Possible states 0 = uninitialized 1 = loading 2 = loaded 3 = interactive 4 = complete this is the one we care about

Example Very simple What to notice IE / non-IE branches of request part callback function Handling returned document with DOM

Example ajax1.html ajax1.php

One problem Limitation on sending data using GET Another possibility encodes data as part of URL insecure max. length usually about 256 characters Another possibility use POST encodes data as request content

Using POST Differences POST argument data string sent with send method set Content-Type header

Example ajax2.html ajax2.php

Usability We are used to web forms clear input modalities nothing happens until you hit submit confirmation in the form of the new page semantics of the "Back" button

Usability II AJAX breaks this anything on page can be used as input because we can put event handlers anywhere actions can happen at any time determined by programmer confirmation up to programmer convention Back button does nothing or worse

Usability III AJAX applications Burden of usability more like traditional desktop applications Burden of usability is on the developer may be intensified because the application doesn't work the "normal" way

Example Google Maps

Compare with Mapquest

How does this work A large map is sent Mapquest scrolled via JavaScript events additional map sectors loaded as needed Mapquest request to the server for a map with certain parameters

Break Lab 6th floor AJAX exercise I can also answer questions about homework #5