Ajax Basics The XMLHttpRequest Object. Ajax is…. Ajax is not…. Ajax is not a programming language. Ajax is not a programming language. Ajax is a methodology.

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.
Asynchronous HTTP request generation in JavaScript (AJAX)
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,
The Document Object Model (DOM) & Asynchronous Javascript And XML (AJAX) : an introduction UFCEKG-20-2 : Data, Schemas and Applications.
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.
CGI and AJAX CS-260 Dick Steflik.
PHP and AJAX ISYS 475. AJAX Asynchronous JavaScript and XML: – JavaScript, Document Object Model, Cascade Style Sheet, XML, server-side script such as.Net,
JavaScript & jQuery the missing manual Chapter 11
Ajax Application Errors Developer Oversight and Tracking Errors Presented by Eric Pascarello.
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.
AJAX Without the “J” George Lawniczak. What is Ajax?
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.
Intro to Ajax Fred Stluka Jan 25, /25/2006Intro to AjaxFred Stluka2 What is Ajax? "Asynchronous JavaScript and XML" New name for an old technique:
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,
Random Logic l Forum.NET l AJAX Behind the buzz word Forum.NET ● January 23, 2006.
Ajax In Action The Journey into Web2.0 Presented by Eric Pascarello.
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 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.
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.
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.
AJAX Asynchronous JavaScript and XML 1. AJAX Outline What is AJAX? Benefits Real world examples How it works 2.
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.
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.
AJAX AJAX Asynchronous JavaScript and XML --- MADHAVI
AJAX – Asynchronous JavaScript And XML By Kranthi Kiran Nuthi CIS 764 Kansas State University.
Internet Technologies #6 REST SOAP AJAX. Agenda  REST  SOAP  AJAX.
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)‏
JavaScript, Sixth Edition Chapter 11 Updating Web Pages with Ajax.
A New Way To Web Applications Development Tin Htut Htut Naing Oo Myanmar Information Technology.
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.
Open Solutions for a Changing World™ Eddy Kleinjan Copyright 2005, Data Access WordwideNew Techniques for Building Web Applications June 6-9, 2005 Key.
JavaScript and Ajax (Ajax Tutorial)
CSE 154 Lecture 11: AJAx.
Understanding XMLHttpRequest
Not a Language but a series of techniques
AJAX AJAX = Asynchronous JavaScript and XML.
AJAX and REST.
XMLHttp Object.
CSE 154 Lecture 11: AJAx.
CSE 154 Lecture 22: AJAX.
Tracking ClientSide Errors Techniques to Track “Blackbox” Errors
JavaScript & 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.
Chengyu Sun California State University, Los Angeles
Chengyu Sun California State University, Los Angeles
AJAX Chapters 19, 20.
Presentation transcript:

Ajax Basics The XMLHttpRequest Object

Ajax is…. Ajax is not…. Ajax is not a programming language. Ajax is not a programming language. Ajax is a methodology Ajax is a methodology Ajax works with the XMLHttpRequest Object. (JavaScript) Ajax works with the XMLHttpRequest Object. (JavaScript) –ActiveX with IE5 to IE6 –Native Object for other browsers and IE7 And your choice of ServerSide Technology And your choice of ServerSide Technology

Ajax does not rely on just the XMLHttpRequest Object Iframes and JSON can also be used instead of the XHR object. Iframes and JSON can also be used instead of the XHR object. We will look into these methods later on. We will look into these methods later on.

Asynchronous JavaScript and XML Utilizes the XMLHttpRequest() Object. Utilizes the XMLHttpRequest() Object. –First implemented in Microsoft Internet Explorer Version 5 for Windows as an ActiveX Object –The other browsers copied Microsoft starting with these versions: Mozilla 1.0 / Firefox 1.0 / Netscape 7 Mozilla 1.0 / Firefox 1.0 / Netscape 7 Opera 8.01 / Opera Mobile Browser 8.0 Opera 8.01 / Opera Mobile Browser 8.0 Safari 1.2 / Konqueror 3.2 / iCab 3.0b352 Safari 1.2 / Konqueror 3.2 / iCab 3.0b352 Plus other minor browsers Plus other minor browsers

What started the hype?

Adaptive Path’s Original Diagram

The Real Life Diagram – How to explain it to your non-geek friends THE COLLEGE PARTY

The Bleak Situation

The Non-Ajax Solution Figure out what is more important and rank order of operation. Figure out what is more important and rank order of operation. Should I clean the mess, get food, or update the outdated music collection? Should I clean the mess, get food, or update the outdated music collection? Perform one task and do the others after each other. Hopefully I have enough time! Perform one task and do the others after each other. Hopefully I have enough time! –Go to Store, Download Music, Clean Apartment so it can be trashed again.

The Ajax Solution Do multiple things at once! Do multiple things at once! Hire a maid to do the cleaning! Hire a maid to do the cleaning! Order delivery pizza! Order delivery pizza! And I can download new music while others do the dirty work! Ajax Clean! And I can download new music while others do the dirty work! Ajax Clean!

Benefits and Problems The Page Weight The Page Weight Rendering Pages Rendering Pages Maintain Page State Maintain Page State Back, Forward, and Refresh Back, Forward, and Refresh Connection Speed Connection Speed JavaScript! JavaScript!

XMLHttpRequest Limitations No Cross Domain Requests No Cross Domain Requests JavaScript Disabled JavaScript Disabled Older Browsers Older Browsers Older Servers Older Servers 508? 508?

CROSS BROWSER JAVASCRIPT

The XHR Object The Gecko / Safari / IE7 Object Constructor The Gecko / Safari / IE7 Object Constructor –req = new XMLHttpRequest(); The ActiveX for IE 6 and earlier The ActiveX for IE 6 and earlier –req = new ActiveXObject("Microsoft.XMLHTTP"); OR –req = new ActiveXObject("Msxml2.XMLHTTP");

XHR Object Methods MethodDescription abort() Stops the current request getAllResponseHeaders() Returns all header (labels/value) sets getResponseHeader("headerLabel") Returns value of a specified header label open("method", "URL"[, asyncFlag[, "userName"[, "password"]]]) The heart and soul! Sets destination URL, method, and other optional attributes send(content) Transmits the request setRequestHeader("label", "value") Assigns header to be sent with a request

XHR open() open("method", "URL", asyncFlag); method = GET or POST open("method", "URL", asyncFlag); method = GET or POST URL = Page to request asyncFlag = True or False

XHR Object Properties PropertyDescription onreadystatechange Event handler for an event that fires at every state change readyState Object status integer responseText String version of data returned from server process responseXML DOM-compatible document object of data returned from server process status Numeric code returned by server, such as 404 for "Not Found" or 200 for "OK" statusText String message accompanying the status code

readyState values 0 – uninitialized 0 – uninitialized 1 – loading 1 – loading 2 – loaded 2 – loaded 3 – interactive 3 – interactive 4 – complete (Can process returned data!) 4 – complete (Can process returned data!)

BASIC DEMO TIME

JavaScript Quiz Quiz..... Quiz..... Quiz.....

Basic Ajax In Action Content Loader var loader1 = new net.ContentLoader( "RequestURL.aspx", "RequestURL.aspx", FinishFunction, FinishFunction, customErrorFunction, customErrorFunction, "POST/GET", "POST/GET", "POST Parameters"); "POST Parameters");

Security No different than a traditional postback No different than a traditional postback Check for SQL Injection Check for SQL Injection Check for JavaScript Injection Check for JavaScript Injection Validate the Data Validate the Data

Hack This Form Basic Form Hack Example Basic Form Hack Example Basic Form Hack Example Basic Form Hack Example

Business Logic - Server or Client Really depends on application Really depends on application Security Security Visual Rendering Visual Rendering Speed - Process data how many times? Speed - Process data how many times? Data size in response/request Data size in response/request XML, Strings, or JSON? XML, Strings, or JSON?

Ajax Developer Must Haves! Drip IE Leak Detector Drip IE Leak Detector Firefox Extensions Firefox Extensions Adblock – Ah, just because! Adblock – Ah, just because! Firebug Firebug Selenium IDE Selenium IDE JSView JSView NOSCRIPT NOSCRIPT Modify Headers Modify Headers

Where to get more info My Blog: My Blog: Forum: Forum: Forum: Forum: Ajax News: Ajax News: Ajax In Action info: Ajax In Action info: Presentation files for this talk will be located at: Presentation files for this talk will be located at:

Larger Demos & Questions