AJAX Basics xhr = new XMLHttpRequest();

Slides:



Advertisements
Similar presentations
Copyright © Steven W. Johnson
Advertisements

Modern JavaScript Develop And Design Instructor’s Notes Chapter 11– Ajax Modern JavaScript Design And Develop Copyright © 2012 by Larry Ullman.
BEA Confidential. | 1 Building REST Service APIs for Rich Internet Applications Peter Laird Managing Architect WebLogic Portal BEA Systems.
9. AJAX & RIA. 2 Motto: O! call back yesterday, bid time return. — William Shakespeare.
Javascript AJAX HTML WEB SERVER Asynchronous. AJAX FUNCTIONS.
AJAX (Asynchronous JavaScript and XML) Amit Jain CS 590 – Winter 2008.
CS 142 Lecture Notes: AjaxSlide 1 AJAX Basics xhr = new XMLHttpRequest(); xhr.onreadystatechange = xhrHandler; xhr.open("POST", url); xhr.send(postData);...
1 JavaScript & AJAX CS , Spring JavaScript.
CS 142 Lecture Notes: FormsSlide 1 AJAX Basics xhr = new XMLHttpRequest(); xhr.onreadystatechange = xhrHandler(); xhr.open("POST", url); xhr.send(postData);...
Chapter 6 DOJO TOOLKITS. Objectives Discuss XML DOM Discuss JSON Discuss Ajax Response in XML, HTML, JSON, and Other Data Type.
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.
JSON (JavaScript Object Notation).  A lightweight data-interchange format  A subset of the object literal notation of JavaScript (or ECMA-262).  A.
Interactive Web Application with AJAX
Introduction to AJAX AJAX Keywords: JavaScript and XML
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.
CSCI 6962: Server-side Design and Programming Introduction to AJAX.
Lecture 12 – AJAX SFDV3011 – Advanced Web Development Reference: 1.
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.
CS 190 Lecture Notes: Tweeter ProjectSlide 1 Uniform Resource Locators (URLs) Scheme Host.
Asterisk based real-time social chat Advisor : Lian-Jou Tsai Student : Jhe-Yu Wu.
Saving Form Data You can save form data in Google Spreadsheets using the following steps. 1.Create a Google Spreadsheet in your documents 2.Use Tools to.
Lecture 9: AJAX, Javascript review..  AJAX  Synchronous vs. asynchronous browsing.  Refreshing only “part of a page” from a URL.  Frameworks: Prototype,
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.
AJAX Asynchronous JavaScript & XML A short introduction.
AJAX in ASP.NET MVC AJAX, Partial Page Rendering, jQuery AJAX, MVC AJAX Helpers SoftUni Team Technical Trainers Software University
Events & Callbacks (ESaaS §6.5) © 2013 Armando Fox & David Patterson, all rights reserved.
 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.
SE-2840 Dr. Mark L. Hornick 1 Introduction to Ajax Asynchronous Javascript And XML.
CHAPTER 13 COMMUNICATING WITH AJAX. LEARNING OBJECTIVES AJAX, which stands for Asynchronous JavaScript and XMLprovides a way for a browser to send and.
CS 142 Lecture Notes: FormsSlide 1 Simple Form Product: Price:
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
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 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..
1 AJAX. AJAX – Whatzit? Asynchronous (content loading)‏ Javascript (logic & control)‏ And XML (request handling)‏
Section led by Ivan Lee Reachable at ivan period lee at cs period stanford period edu 1.
NCCUCS 軟體工程概論 Lecture 5: Ajax, Mashups April 29, 2014.
How to consume a RESTful service using jQuery. Introduction  In this post we see how to consume the RESTful service described in the post Design a RESTful.
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.
AJAX. Objectives Understand and apply AJAX Using AJAX in DOJO library.
4.3. Code animations by using JavaScript Access data access by using JavaScript. Creating Animations, Working with Graphics, and Accessing Data.
Internet Technologies
CSE 154 Lecture 11: AJAx.
Understanding XMLHttpRequest
AJAX and jQuery AJAX AJAX Concepts, XMLHttpRequest, jQuery AJAX: $.ajax(), $.get(), $.post() jQuery AJAX XMLHttpRequest SoftUni Team Technical Trainers.
Callback Function function passed as a parameter to another function
CSE 154 Lecture 11: AJAx.
CSE 154 Lecture 22: AJAX.
Web Browser server client 3-Tier Architecture Apache web server PHP
AJAX Basics xhr = new XMLHttpRequest();
Asynchronous Javascript And XML
CS 140 Lecture Notes: Protection
CS 140 Lecture Notes: Protection
CS 142 Lecture Notes: Cookies
JavaScript & jQuery AJAX.
Web Programming Language
AJAX Basics xhr = new XMLHttpRequest();
CS 140 Lecture Notes: Protection
Lecture 12: The Fetch Api and AJAx
AJAX CS-422 Dick Steflik.
Web-Applications & AJAX
Lecture 12: The Fetch Api and AJAx
Uniform Resource Locators (URLs)
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
What is AJAX? AJAX is a developer's dream, because you can:
Carnegie Mellon Heinz College
Presentation transcript:

AJAX Basics xhr = new XMLHttpRequest(); xhr.onreadystatechange = xhrHandler; xhr.open("POST", url); xhr.send(postData); ... function xhrHandler() { if (this.readyState != 4) { return; } if (this.status != 200) { // Handle error ... var text = this.responseText; State 4 means “done” Raw text of response (also available as XML) CS 142 Lecture Notes: Ajax

JSON {name: "Alice", gpa: 3.5, friends: ["Bill", "Carol", "David"]} CS 142 Lecture Notes: Ajax

AJAX response (from XMLHttpRequest object) JSON Example Controller code: Class StudentsController < ApplicationController def get_students @students = Student.find(:all) render :text => @students.to_json(); end end [{"advisor_id":"2","birth":"1987-10-22", "gpa":3.9,"grad":2009,"id":1, "name":"Anderson"}, {"advisor_id":"1","birth":"1990-04-16", "gpa":3.1,"grad":2012,"id":2, "name":"Jones"}, ... ] Javascript in browser: var students = eval(xhr.responseText); JSON Output AJAX response (from XMLHttpRequest object)

CS 142 Lecture Notes: Cookies