Lecture 12 – AJAX SFDV3011 – Advanced Web Development Reference: 1.

Slides:



Advertisements
Similar presentations
Ajax. Overview of Ajax History In the 1990s, most web sites were based on complete HTML pages; each user action required that the page be re-loaded from.
Advertisements

AJAX Compiled from “AJAX Programming” [Sang Shin]
Dodick Zulaimi Sudirman Lecture 12 Introduction to AJAX Pengantar Teknologi Internet Introduction to Internet Technology.
9. AJAX & RIA. 2 Motto: O! call back yesterday, bid time return. — William Shakespeare.
AJAX Presented by: Dickson Fu Dimas Ariawan Niels Andreassen Ryan Dial Jordan Nielson CMPUT 410 University of Alberta 2006.
AJAX asynchronous server-client communication. Test.
1 JavaScript & AJAX CS , Spring JavaScript.
Using AJAX Galip Aydin, Ahmet Sayar, and Marlon Pierce Community Grids Lab Indiana University.
Interactive Web Application with AJAX
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
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
AJAX and Java ISYS 350. AJAX Asynchronous JavaScript and XML: – Related technologies: JavaScript, Document Object Model, XML, server-side script such.
06/10/2015AJAX 1. 2 Introduction All material from AJAX – what is it? Traditional web pages and operation Examples of AJAX use Creating.
Instructor, Dr. Khalili Bahram Jeevan Kumar Gogineni.
Ajax. –Asynchronous JavaScript and XML –Umbrella term for technologies that often: Use client-side scripting for layout and formatting Use less than full.
Random Logic l Forum.NET l AJAX Behind the buzz word Forum.NET ● January 23, 2006.
AJAX (also known as: XMLHTTP, Remote Scripting, XMLHttpRequest, etc.) Matt Warden.
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. –Asynchronous JavaScript and XML –Umbrella term for technologies that often: Use client-side scripting for layout and formatting Use less than full.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
CISC 3140 (CIS 20.2) Design & Implementation of Software Application II Instructor : M. Meyer Address: Course Page:
the acronym for Asynchronous JavaScript and XML.
Ajax for Dynamic Web Development Gregory McChesney.
Chapter 16: Ajax-Enabled Rich Internet Applications with XML and JSON TP2543 Web Programming Mohammad Faidzul Nasrudin.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
AJAX Asynchronous JavaScript and XML 1. AJAX Outline What is AJAX? Benefits Real world examples How it works 2.
JQuery and AJAX WEB Technologies : PHP Programming Language.
CHAPTER 13 COMMUNICATING WITH AJAX. LEARNING OBJECTIVES AJAX, which stands for Asynchronous JavaScript and XMLprovides a way for a browser to send and.
Event Handling & AJAX IT210 Web Systems. Question How do we enable users to dynamically interact with a website? Answer: Use mouse and keyboard to trigger.
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
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.
Dave Salinas. What is XML? XML stands for eXtensible Markup Language Markup language, like HTML HTML was designed to display data, whereas XML was designed.
AJAX AJAX Asynchronous JavaScript and XML --- MADHAVI
Introduction to AJAX Sue Brandreth. What is Ajax?
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?
1 AJAX. AJAX – Whatzit? Asynchronous (content loading)‏ Javascript (logic & control)‏ And XML (request handling)‏
Introduction to AJAX MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/4/2016.
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.
JavaScript and Ajax (Ajax Tutorial)
Not a Language but a series of techniques
AJAX AJAX = Asynchronous JavaScript and XML.
CS 371 Web Application Programming
AJAX and REST.
AJAX – Asynchronous JavaScript and XML
AJAX.
Asynchronous Java script And XML Technology
AJAX.
Introduction to AJAX MIS 3502 Jeremy Shafer Department of MIS
Introduction to AJAX MIS 3502 Jeremy Shafer Department of MIS
CSE 154 Lecture 22: AJAX.
ISC440: Web Programming 2 AJAX
JavaScript & jQuery AJAX.
MIS JavaScript and API Workshop (Part 3)
AJAX CS-422 Dick Steflik.
Web Technology Even Sem 2015
Introduction to AJAX and JSON
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
AJAX Chapters 19, 20.
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Creating dynamic/interactive web pages
AJAX By Prof. B.A.Khivsara
Presentation transcript:

Lecture 12 – AJAX SFDV3011 – Advanced Web Development Reference: 1

What is AJAX?  Stands for Asynchronous JavaScript And XML  A range of technologies that allows to update web page content without reloading the entire page: HTML, CSS, DOM, JavaScript, XMLHttpRequest object, XML  Term coined by Jesse James Garrett in

AJAX’s Purpose  The purpose is to make the user’s experience smoother  Without Ajax, even a small change to a page requires a whole page reload (assuming that data needs to come from the server)  You can think of each page reload as a synchronisation point – all events happen in one instant burst  The problem with synchronisation is that some events could happen now, but can’t because other things aren’t ready or, there are other things that needn’t happen at all, but must because something else has to happen  Asynchronous updates allow small updates to happen when they need to 3

Examples  Google Maps - zoom, pan etc.  Even clearer demonstration of the purpose is Google Suggest  Gmail mimics a desktop application  One-click bids/buys that give you instant feedback on the original page  Netflix’s tooltips  Form validation using server-side script  Basecamp’s Yellow Fade Technique 4

So What is Going On?  In your browser’s scripting language, create an XMLHttpRequest object  Specify what code will be called each time the XMLHttpRequest object’s state changes  Use the object’s open method to set up a request to the server using GET or POST  Send the request using the send method 5

XMLHttpRequest Creation 6 var xmlHttp ; function createXMLHttpRequest () { if ( window. ActiveXObject ) { xmlHttp = new ActiveXObject (" Microsoft. XMLHTTP "); } else if ( window. XMLHttpRequest ) { xmlHttp = new XMLHttpRequest (); }  IE5 and IE6 support XMLHTTPRequest object in ActiveX

Do a Request 7 function startRequest () { createXMLHttpRequest (); xmlHttp. onreadystatechange = handleStateChange ; xmlHttp. open (" GET ", " hello. php ", true); xmlHttp. send (null); }  open method: third param sets request to be asynchronous  send method: optional param for request body (including POST string)

Do Something with the Response 8 function handleStateChange () { if ( xmlHttp. readyState == 4) { if ( xmlHttp. status == 200) { finishAjax (); }  The XMLHttpRequest object has 5 possible states: 0 = uninitialised, 1 = loading, 2 = loaded, 3 = interactive, 4 = complete.  finishAjax can do something with the responseText attribute function finishAjax () { var respStr = xmlHttp. responseText ; document. getElementById (" content "). innerHTML = respStr ; }

Communication Methods 9  Ajax obeys JavaScript’s same origin rule  Communication to the server can be query a string (GET or POST)  Could also send XML or JSON in the body  Server sends back a stream of text - could be XML or JSON (or anything really)  Advantage of XML or JSON: browser can parse it and manipulate it as an object