Chapter 16: Ajax-Enabled Rich Internet Applications with XML and JSON TP2543 Web Programming Mohammad Faidzul Nasrudin.

Slides:



Advertisements
Similar presentations
Dodick Zulaimi Sudirman Lecture 12 Introduction to AJAX Pengantar Teknologi Internet Introduction to Internet Technology.
Advertisements

9. AJAX & RIA. 2 Motto: O! call back yesterday, bid time return. — William Shakespeare.
 2008 Pearson Education, Inc. All rights reserved Ajax-Enabled Rich Internet Applications.
AJAX Presented by: Dickson Fu Dimas Ariawan Niels Andreassen Ryan Dial Jordan Nielson CMPUT 410 University of Alberta 2006.
IS 360 Course Introduction. Slide 2 What you will Learn (1) The role of Web servers and clients How to create HTML, XHTML, and HTML 5 pages suitable for.
Cloud Computing Lecture #7 Introduction to Ajax Jimmy Lin The iSchool University of Maryland Wednesday, October 15, 2008 This work is licensed under a.
Chapter 9 Introduction to the Document Object Model (DOM) JavaScript, Third Edition.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Prof. James A. Landay University of Washington Spring 2008 Web Interface Design, Prototyping, and Implementation Rich Internet Applications: AJAX, Server.
INTRODUCTION TO WEB DATABASE PROGRAMMING
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Chris Pinski.  History  What is Ajax  Who uses Ajax  Underlying Technologies  SE Aspect  Common Problems  Conclusion.
JavaScript & jQuery the missing manual Chapter 11
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
Ruth Betcher Ruth Christie
Dr. Azeddine Chikh IS444: Modern tools for applications development.
CSCI 6962: Server-side Design and Programming Introduction to AJAX.
Lecture 12 – AJAX SFDV3011 – Advanced Web Development Reference: 1.
ASP.NET + Ajax Jesper Tørresø ITNET2 F08. Ajax Ajax (Asynchronous JavaScript and XML) A group of interrelated web development techniques used for creating.
 2008 Pearson Education, Inc. All rights reserved Ajax-Enabled Rich Internet Applications.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
AJAX Without the “J” George Lawniczak. What is Ajax?
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
Ajax Technology for the Web Nic Shulver, FCET, Staffordshire University Introduction What is it? Pros and Cons Why is it important? Traditional Client-Server.
 2008 Pearson Education, Inc. All rights reserved Ajax-Enabled Rich Internet Applications.
JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting.
1 rfXcel Confidential Copyright 2007 Web Technology JavaScript 12/10/07.
AJAX and Atlas in ASP.NET 2.0 William J. Steele MSDN Developer Evangelist Microsoft Corporation
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.
The Web Architecture and ASP.NET. Slide 2 Review of the Web (1) It began with HTTP and HTML, which delivers static Web pages to browsers which would render.
JavaScript, Fourth Edition
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Random Logic l Forum.NET l AJAX Behind the buzz word Forum.NET ● January 23, 2006.
Ventsislav Popov Crossroad Ltd.. 1. What is AJAX?  AJAX Concept  ASP.NET AJAX Framework 2. ASP.NET AJAX Server Controls  ScriptManager, UpdatePanel.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Telerik Software Academy ASP.NET Web Forms Telerik Software Academy ASP.NET Web Forms.
AJAX Compiled from “AJAX Programming” [Sang Shin] (Asynchronous JavaScript and XML)
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Bookstore Application: Middle Tier Introducing Code-Behind Files, Session State.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
 2008 Pearson Education, Inc. All rights reserved Ajax-Enabled Rich Internet Applications.
SE-2840 Dr. Mark L. Hornick 1 Introduction to Ajax Asynchronous Javascript And XML.
IT533 Lectures ASP.NET AJAX.
Creating Animations, Working with Graphics, and Accessing Data Lesson 9.
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.
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 CS456 Fall Examples Where is AJAX used? Why do we care?
Overview Web Technologies Computing Science Thompson Rivers University.
JavaScript, Sixth Edition Chapter 11 Updating Web Pages with Ajax.
NCCUCS 軟體工程概論 Lecture 5: Ajax, Mashups April 29, 2014.
JQuery, JSON, AJAX. AJAX: Async JavaScript & XML In traditional Web coding, to get information from a database or a file on the server –make an HTML form.
INNOV-16: Rich User Interface for the Web???? AJAX to the Rescue Ken Wilner VP of Technology Progress Software.
JavaScript and Ajax (Ajax Tutorial)
Not a Language but a series of techniques
AJAX and REST.
AJAX.
IS 360 Course Introduction
JavaScript & jQuery AJAX.
MIS JavaScript and API Workshop (Part 3)
DR. JOHN ABRAHAM PROFESSOR UTPA
Chengyu Sun California State University, Los Angeles
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Chengyu Sun California State University, Los Angeles
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Presentation transcript:

Chapter 16: Ajax-Enabled Rich Internet Applications with XML and JSON TP2543 Web Programming Mohammad Faidzul Nasrudin

16.1 Introduction Usability of web applications has lagged behind that of desktop applications Rich Internet Applications (RIAs) – Web applications that approximate the look, feel and usability of desktop applications – Two key attributes—performance and rich GUI RIA performance – Comes from Ajax (Asynchronous JavaScript and XML), which uses client-side scripting to make web applications more responsive

What is the different between Asynchronous and Asynchronous?

16.1 Introduction (2)

16.1 Introduction (3) Ajax applications separate client-side user interaction and server communication, and run them in parallel, making the delays of server-side processing more transparent to the user “Raw” Ajax: – uses JavaScript to send asynchronous requests to the server, then updates the page using the DOM – need to deal directly with cross-browser portability issues, making it impractical for developing large-scale applications

16.1 Introduction (4) Portability issues – Hidden by Ajax toolkits, such as jQuery, ASP.NET Ajax and JSF’s Ajax capabilities, which provide powerful ready-to-use controls and functions that enrich web applications and simplify JavaScript coding by making it cross-browser compatible. Achieve rich GUI in RIAs with – JavaScript toolkits, providing powerful ready-to- use controls and functions that enrich web applications.

16.1 Introduction (5) Client-side of Ajax applications – Written in HTML5 and CSS3 – Uses JavaScript to add functionality to the user interface XML and JSON are used to structure the data passed between the server and the client XMLHttpRequest – The Ajax component that manages interaction with the server – Commonly abbreviated as XHR.

Traditional Web Applications Traditional web applications – User fills in the form’s fields, then submits the form – Browser generates a request to the server, which receives the request and processes it – Server generates and sends a response containing the exact page that the browser will render – Browser loads the new page and temporarily makes the browser window blank – Client waits for the server to respond and reloads the entire page with the data from the response

Traditional Web Applications (2) While a synchronous request is being processed on the server, the user cannot interact with the client web browser The synchronous model was originally designed for a web of hypertext documents – some people called it the “brochure web” – model yielded inconsistent application performance

Traditional Web Applications (3)

Ajax Web Applications In an Ajax application, when the user interacts with a page – Client creates an XMLHttpRequest object to manage a request – XMLHttpRequest object sends the request to and awaits the response from the server – Requests are asynchronous, allowing the user to continue interacting with the application while the server processes the request concurrently

Ajax Web Applications (2) – When the server responds, the XMLHttpRequest object that issued the request invokes a callback function, which typically uses partial page updates to display the returned data in the existing web page without reloading the entire page Callback function updates only a designated part of the page – Partial page updates help make web applications more responsive, making them feel more like desktop applications

Ajax Web Applications (3)

16.2 Rich Internet Applications (RIAs) with Ajax Classic HTML registration form – Sends all of the data to be validated to the server when the user clicks the Register button – While the server is validating the data, the user cannot interact with the page – Server finds invalid data, generates a new page identifying the errors in the form and sends it back to the client— which renders the page in the browser – User fixes the errors and clicks the Register button again – Cycle repeats until no errors are found, then the data is stored on the server – Entire page reloads every time the user submits invalid data

16.2 Rich Internet Applications (RIAs) with Ajax (2) Ajax-enabled forms are more interactive – Entries are validated individually, dynamically as the user enters data into the fields – If a problem is found, the server sends an error message that is asynchronously displayed to inform the user of the problem – Sending each entry asynchronously allows the user to address invalid entries quickly, rather than making edits and resubmitting the entire form repeatedly until all entries are valid – Asynchronous requests could also be used to fill some fields based on previous fields’ values (e.g., city based on zip code)

16.2 Rich Internet Applications (RIAs) with Ajax (3)

16.2 Rich Internet Applications (RIAs) with Ajax (4)

16.2 Rich Internet Applications (RIAs) with Ajax (5)

Infamous AJAX Animation Icon When, XMLHttpRequest object sends the request to and awaits the response from the server, developer usually display these icons to users.

16.3 History of Ajax The term Ajax was coined by Jesse James Garrett of Adaptive Path in February 2005, when he was presenting the previously unnamed technology to a client Ajax technologies (HTML, JavaScript, CSS, dynamic HTML, the DOM and XML) had existed for many years prior to 2005 In 1998, Microsoft introduced the XMLHttpRequest object to create and manage asynchronous requests and responses

16.3 History of Ajax (2) Popular applications like Flickr, Google’s Gmail and Google Maps use the XMLHttpRequest object to update pages dynamically Ajax has enabled “webtop” applications to challenge the dominance of established desktop applications This has become increasingly significant as more and more computing moves to “the cloud.”

16.4 “Raw” Ajax Example using the XMLHttpRequest Object XMLHttpRequest object – Resides on the client – Is the layer between the client and the server that manages asynchronous requests in Ajax applications – Supported on most browsers, though they may implement it differently To initiate an asynchronous request – Create an instance of the XMLHttpRequest object – Use its open method to set up the request, and its send method to initiate the request

16.4 “Raw” Ajax Example using the XMLHttpRequest Object When an Ajax application requests a file from a server, the browser typically caches that file – Subsequent requests for the same file can load it from the browser’s cache When the third argument to XMLHttpRequest method open is true, the request is asynchronous

Demo

XMLHttpRequest Object Event, Properties and Methods The following figures summarize some of the XMLHttpRequest object’s properties and methods, respectively. The properties are crucial to interacting with asynchronous requests. The methods initialize, configure and send asynchronous requests.

XMLHttpRequest Object Event, Properties and Methods (2)

XMLHttpRequest Object Event, Properties and Methods (3)

XMLHttpRequest Object Event, Properties and Methods (4)

16.6 Creating a Full-Scale Ajax-Enabled Application The web application may interacts with a web service to obtain data and to modify data in a server-side database. The web application and server communicate with a data format called JSON (JavaScript Object Notation). The application executes server-side functions (or APIs) that occurs in parallel with the user interacting with the web application.

Using JSON JSON (JavaScript Object Notation) – Simple way to represent JavaScript objects as strings – A simpler alternative to XML for passing data between the client and the server – API in many programming languages JSON object – Represented as a list of property names and values contained in curly braces – { "propertyName1" : value1, "propertyName2": value2 }

Array – Represented in JSON with square brackets containing a comma-separated list of values – Each value in a JSON array can be a string, a number, a JSON representation of an object, true, false or null – "array_name“: [ { "propertyName1" : value1, "propertyName2": value2 }, { "propertyName1" : value1, "propertyName2": value2 } ]

JSON strings – Easier to create and parse than XML – Require fewer bytes – For these reasons, JSON is commonly used to communicate in client/server interaction

Parsing JSON Data Web service’s functions or APIs may returns a JSON representation of an object or array of objects. For example, when the web application requests the list of names in the address book, the list is returned as a JSON array.

Address-book data formatted in JSON: [ { "first": "Cheryl", "last": "Black" }, { "first": "James", "last": "Blue" }, { "first": "Mike", "last": "Brown" }, { "first": "Meg", "last": "Gold" } ] When the XMLHttpRequest object receives the response, it calls the JSON.parse function, which converts the JSON string into a JavaScript object

Picture PHP JSON

Demo

The End Thank You