1 JavaScript & AJAX CS 236607, Spring 2008. 2 JavaScript.

Slides:



Advertisements
Similar presentations
University of Virginia 1 Modern Web Application Development Overview of some newer web applications methods Web 2.0 Ajax fundamentals Ruby on Rails.
Advertisements

AJAX Asynchronous JavaScript and XML. AJAX An interface that allows for the HTTP communication without page refreshment Web pages are loaded into an object.
1 AJAX – Asynchronous JavaScript and XML – Part II CS , Spring 2010.
© Copyright 2008 STI - INNSBRUCK Web Engineering Web Technologies III Lecture XI – 16 th December 2008 Federico M. Facca.
Web 2.0 with AJAX Students : LASC Ioana KELEMEN Csilla POP Dan Adrian CIOBANU Dumitru Daniel Project leaders : Jean Luc LARBOT Ahmed RHIAT.
AJAX Technologies KAUNAS UNIVERSITY OF TECHNOLOGY MODULE: INFORMATION TECHNOLOGY GROUP: IF - 4/9 GROUP: VENTILIATORIAI
9. AJAX & RIA. 2 Motto: O! call back yesterday, bid time return. — William Shakespeare.
6/3/2015eBiquity1 Tutorial on AJAX Anubhav Kale (akale1 AT cs DOT umbc DOT edu)
AJAX Presented by: Dickson Fu Dimas Ariawan Niels Andreassen Ryan Dial Jordan Nielson CMPUT 410 University of Alberta 2006.
WHAT IS AJAX? Zack Sheppard [zts2101] WHIM April 19, 2011.
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.
1 JavaScript & AJAX CS , Winter 2007/8. 2 JavaScript.
Prof. James A. Landay University of Washington Spring 2008 Web Interface Design, Prototyping, and Implementation Rich Internet Applications: AJAX, Server.
Agenda What is AJAX? What is jQuery? Demonstration/Tutorial Resources Q&A.
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.
CS 4720 RESTfulness and AJAX CS 4720 – Web & Mobile Systems.
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.
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.
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 Compiled from “AJAX Programming” [Sang Shin] (Asynchronous JavaScript and XML)
Ajax. –Asynchronous JavaScript and XML –Umbrella term for technologies that often: Use client-side scripting for layout and formatting Use less than full.
-By V.Gouthaman. INTRODUCTION Ajax (shorthand for asynchronous JavaScript and XML) is a group of interrelated web development techniques used on the client-side.
Server-side Programming The combination of –HTML –JavaScript –DOM is sometimes referred to as Dynamic HTML (DHTML) Web pages that include scripting are.
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.
School of Computing and Information Systems CS 371 Web Application Programming AJAX.
the acronym for Asynchronous JavaScript and XML.
Ajax for Dynamic Web Development Gregory McChesney.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
 AJAX – Asynchronous JavaScript and XML  Ajax is used to develop fast dynamic web applications  Allows web pages to be updated asynchronously by transferring.
AJAX Asynchronous JavaScript and XML 1. AJAX Outline What is AJAX? Benefits Real world examples How it works 2.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
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.
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 & Introduction to AJAX
AJAX AJAX Asynchronous JavaScript and XML --- MADHAVI
AJAX – Asynchronous JavaScript And XML By Kranthi Kiran Nuthi CIS 764 Kansas State University.
INNOV-2: Build a Better Web Interface Using AJAX Chris Morgan Pandora Software Systems
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?
PHP and AJAX. Servers and Clients For many years we tried to move as much as possible to the server. Weak clients, poor bandwidth, browser compatibility..
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.
Ajax & Client-side Dynamic Web Gunwoo Park (Undergraduate)
AJAX Rohan B Thimmappa. What Is AJAX? AJAX stands for Asynchronous JavaScript and XML. AJAX stands for Asynchronous JavaScript and XML. A remote scripting.
Introduction to AJAX Pat Morin COMP Outline What is AJAX? – History – Uses – Pros and Cons An XML HTTP Transaction – Creating an XMLHTTPRequest.
JavaScript and Ajax (Ajax Tutorial)
CS 371 Web Application Programming
AJAX – Asynchronous JavaScript and XML
Asynchronous Java script And XML Technology
AJAX.
CSE 154 Lecture 22: AJAX.
AJAX CS-422 Dick Steflik.
Intro to Ajax Fred Stluka Jan 25, 2006.
AJAX By Prof. B.A.Khivsara
Presentation transcript:

1 JavaScript & AJAX CS , Spring 2008

2 JavaScript

3 Overview JavaScript is a scripting language most often used for client-side web development, and best known for this use in websites (as client-side JavaScript). JavaScript is essentially unrelated to the Java programming language, though it copies many Java names and naming conventions. JavaScript is used in many Web pages to add functionality, validate forms, detect browsers, and much more.

4 JavaScript by Examples We will look at some JavaScript examples…

5 HelloWorld.html document.write(“ Hello World! "); DOM treatment of the page

6 DocumentURL.html The URL of this document is: document.write(document.URL);

7 More Examples Count the number of images in a document What are the coordinates of the cursor?  Notice events are thrown (events-driven)

Form Validation function validate() …(next slide) Name (max 10 chararcters): Age (from 1 to 100):

Form Validation (Cont.) function validate() { var var age=document.getElementById("age").value; var fname=document.getElementById("fname").value; submitOK="true"; if (fname.length>10){ alert("The name must be less than 10 characters"); submitOK="false"; } if (isNaN(age)||age 100) { alert("The age must be a number between 1 and 100"); submitOK="false"; } if (at==-1) { alert("Not a valid !"); submitOK="false"; } if (submitOK=="false") { return false; } } DOM Objects JavaScript Function Object Property

10 AJAX

11 Where Were We Before AJAX? Static pages give the illusion of interactivity through standard form submissions. Form submissions result in full page loads.

12 So, What’s The Problem? Many actions only manipulate small portions of the page but the entire page must be reloaded. Server responses contain the entire page content rather than just the portion being updated. Loading entire pages typically results in several additional HTTP requests for images, style sheets, scripts, and any other content that may be on the page.

13 AJAX - Asynchronous JavaScript and XML A group of interrelated web development techniques used on the client-side to create interactive web applications / rich Internet applications. With Ajax, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page. Thus, the Web page can communicate with the server without refreshing the whole page.

14 Real-Life Examples of AJAX Apps Google maps  Goolgle Suggest (Now integrated in Google’s homepage)  Yahoo Maps  Many more…

15 AJAX Components JavaScript  DOM XMLHttpRequest object ( XHR ) XML

16 Ajax Fundamentals Ajax uses a three-step process: 1.Request a URL by the JavaScript code – client side. 2.Handle the URL on the server and write to the response – server side. 3.After the response is complete, integrate the response into the DOM (Document Object Model) – client side.  In an Ajax request we don't refresh the entire page; instead, we update only part of the page.

17 The Server side Did we reduce the load on the server? Ajax newcomers sometimes mistakenly believe that Ajax, because it provides a more responsive user interface, reduces server-side traffic. In fact, Ajax applications typically have more server-side traffic because each Ajax request involves a trip to the server.  Because those requests are asynchronous, however, Ajax creates the perception of a more responsive UI, though it typically does not reduce the load on the server.

18 So, How Does It Work? JavaScript is used to:  Create and control instances of the XMLHttpRequest (XHR) object.  Provide handlers for responses.  Manipulate the DOM. The XMLHttpRequest object:  Allows scripts to perform HTTP client functionality.  Supports GET and POST operations.

19 Launching HTTP Requests Typically, 3 steps are required: Construct and configure an XMLHttpRequest object Launch the request Process the response

20 Constructing an XMLHttpRequest For Mozilla: For Microsoft Explorer: var request = new XMLHttpRequest(); var request = new ActiveXObject("Microsoft.XMLHTTP");

21 Configuring an XMLHttpRequest request.open("method","URL",false) request.setRequestHeader("header","value") method is GET, POST, etc. URL must be in the domain of the current (or a relative URL), for security reasons The false will be discussed later

22 Launching the Request request.send(content ) content is the posted in a POST request content can be "null" or empty

Reading the Response request.responseText The response as flat text request.responseXML The response as a (DOM) Document object Available if response Content-Type is text/XML request.statusrequest.statusText request.getAllResponseHeaders() request.getResponseHeader("header") The XHR Object

24 To be continued…