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.

Slides:



Advertisements
Similar presentations
CS7026 jQuery Events. What are Events?  jQuery is tailor-made to respond to events in an HTML page.  Events are actions that can be detected by your.
Advertisements

Dodick Zulaimi Sudirman Lecture 12 Introduction to AJAX Pengantar Teknologi Internet Introduction to Internet Technology.
AJAX Presented by: Dickson Fu Dimas Ariawan Niels Andreassen Ryan Dial Jordan Nielson CMPUT 410 University of Alberta 2006.
Lecture Bells and Whistles. Ways to Enhance Websites Java Script and Java Sound and Video Flash XML (Extended Markup Language Database Connectivity Ecommerce.
Ajax Dr Jim Briggs WEBP Ajax1. 2 Ajax Asynchronous JavaScript And XML Method of creating more interactive web applications Moves more of the application.
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.
Dynamic Web Pages Bert Wachsmuth. Review  Internet, IP addresses, ports, client-server, http, smtp  HTML, XHTML, XML  Style Sheets, external, internal,
Does Ajax suck? CS575 Spring 2007 Chanwit Suebsureekul.
Prof. James A. Landay University of Washington Spring 2008 Web Interface Design, Prototyping, and Implementation Rich Internet Applications: AJAX, Server.
Introduction to AJAX AJAX Keywords: JavaScript and XML
JavaScript & jQuery the missing manual Chapter 11
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
May 16 – 18, 2007 Copyright 2007, Data Access Worldwide May 16 – 18, 2007 Copyright 2007, Data Access Worldwide Build Great Web Application 'Fast and Easy'
Ruth Betcher Ruth Christie
Lecture 12 – AJAX SFDV3011 – Advanced Web Development Reference: 1.
 2008 Pearson Education, Inc. All rights reserved Ajax-Enabled Rich Internet Applications.
Intro to JavaScript Events. JavaScript Events Events in JavaScript let a web page react to some type of input Many different ways to handle events due.
 2008 Pearson Education, Inc. All rights reserved Ajax-Enabled Rich Internet Applications.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
1 rfXcel Confidential Copyright 2007 Web Technology JavaScript 12/10/07.
JavaScript: Functions © by Pearson Education, Inc. All Rights Reserved.
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.
Web Programming Brian Toone 8/27/2014. Outline for today 1.Understanding the architecture of the web 2.Overview of programming languages – Client-side.
AJAX Compiled from “AJAX Programming” [Sang Shin] (Asynchronous JavaScript and XML)
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.
Dialog boxes in JavaScript Events in JavaScript – What are they – “Which events are there?” – “How do I register event handlers to an HTML element?” –
The Problem of State. We will look at… Sometimes web development is just plain weird! Internet / World Wide Web Aspects of their operation The role of.
Web Technology Introduction AJAXAJAX. AJAX Outline  What is AJAX?  Benefits  Real world examples  How it works  Code review  Samples.
The Module Road Map Assignment 1 Road Map We will look at… Internet / World Wide Web Aspects of their operation The role of clients and servers ASPX.
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  Ajax is used to develop fast dynamic web applications  Allows web pages to be updated asynchronously by transferring.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
CHAPTER 13 COMMUNICATING WITH AJAX. LEARNING OBJECTIVES AJAX, which stands for Asynchronous JavaScript and XMLprovides a way for a browser to send and.
7. JavaScript Events. 2 Motto: Do you think I can listen all day to such stuff? –Lewis Carroll.
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.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
Events Event Handling in JavaScript SoftUni Team Technical Trainers Software University
Introduction 1.HTML DOM events allow JavaScript to register different event handlers on elements in an HTML document. 2.Events are normally used in combination.
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.
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..
Ajax! Ajax Programming Ajax! Ajax Programming. Ajax! Ajax Programming Take a look at a typical desktop application (Spreadsheet app, etc.) The program.
Jozef Goetz contribution, © by Pearson Education, Inc. All Rights Reserved.
Introduction to JavaScript Events Instructor: Sergey Goldman 1.
Internet & World Wide Web How to Program, 5/e.  JavaScript events  allow scripts to respond to user interactions and modify the page accordingly  Events.
JavaScript and Ajax (Ajax Tutorial)
CSE 154 Lecture 11: AJAx.
Not a Language but a series of techniques
AJAX and REST.
AJAX.
Asynchronous Java script And XML Technology
AJAX.
CSE 154 Lecture 11: AJAx.
CSE 154 Lecture 22: AJAX.
COP 3813 Intro to Internet Computing
ISC440: Web Programming 2 AJAX
DR. JOHN ABRAHAM PROFESSOR UTPA
CS7026 jQuery Events.
CHAPTER 6 EVENTS. CHAPTER 6 EVENTS WHAT IS AN EVENT?
Creating dynamic/interactive web pages
AJAX By Prof. B.A.Khivsara
Presentation transcript:

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 Events (e.g., “click”, “hover”, press ctrl key) that call functions (Event Handlers) Use AJAX asynchronous requests to update portions of a webpage in parallel (based on Events)

Event Handling in JavaScript

Event Handling Event Something that a user or the page does Click Event Handler Code that executes when an event occurs; typically a function PlayMusic() Event Registration Connects DOM element, Event, and Event Handler together <button onclick = “PlayMusic()” DOM Element HTML element tied to an Event Play

Event Registration Techniques 1. Inline HTML EventHandlers: 2. Javascript event property assignment object.onclick=“PlayMusic()“; 3. addEventListener method (recommended) object.addEventListener( “click”, PlayMusic, false); object.addEventListener(“click”, function() {JS code}, false)

Events load click dblclick focus keydown keyup mouseover reset submit …

Events are also Objects! Event Properties include: button (which mouse button was clicked?) altKey (was the Alt key pressed?) target (the DOM element that triggered the event) timeStamp (when was the event triggered?) type (name of event) Event Methods also exist

AJAX

What is AJAX?  AJAX = Asynchronous JavaScript + XML  Not a new technology! A way of using old technologies  HTML, CSS, DOM, Javascript, & XMLHttpRequest  Downloads data without reloading entire page  Allows dynamic user experience  Aids in creation of Rich Internet Applications (RIAs)  Gmail, google Maps, Flickr…

 2008 Pearson Education, Inc. All rights reserved. 10 Fig | Classic web application reloading the page for every user interaction.

 2008 Pearson Education, Inc. All rights reserved. 11 Fig | Ajax-enabled web application interacting with the server asynchronously.

AJAX Demo from textbook

XMLHttpRequest in action

XMLHttpRequest Template

Server Side Could be a simple file request (as above) Or pass a php file name Or other script (.asp etc) asyncRequest.open('GET',“myScript.php ?q="+str, true ); The php file could query a database

 2008 Pearson Education, Inc. All rights reserved. 16 Fig | XMLHttpRequest object properties. * *

 2008 Pearson Education, Inc. All rights reserved. 17 Fig | XMLHttpRequest object methods. (Part 1 of 2.) * *

 2008 Pearson Education, Inc. All rights reserved. 18 Fig | XMLHttpRequest object methods. (Part 2 of 2.)

XMLHttpRequest Security can only be run on a web page stored on a web server (e.g. not your C: drive) can only fetch files from the same site that the page is on can only fetch from

Review What are the main benefits of using AJAX? (T/F) AJAX is a language specifically designed for asynchronous communications client  server What is the name of the Class/Object that allows for asynch communication between the client and server? Are responses always XML documents?

How it works—another view

Swim lane representation