AJAX and REST - Web Programming - Lecture Slides, Slides of Computer Programming

If you are looking for Web Programming course, you are at right place. This lecture key words are: Ajax and Rest, Ajax Model, Ajax Framework, Restfull Apis, Mechanics, Ajax Xmlhttprequest, Ajax Response, Synchronous, Rest, Ajax References

Typology: Slides

2012/2013

Uploaded on 09/27/2013

vikrant
vikrant 🇮🇳

4.4

(9)

119 documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
AJAX and REST
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download AJAX and REST - Web Programming - Lecture Slides and more Slides Computer Programming in PDF only on Docsity!

AJAX and REST

What is AJAX?

 It’s an acronym for Asynchronous JavaScript and XML  Although requests need not be asynchronous  It’s not really a single technology but several  HTML / CSS / DOM / XML  It’s used to dynamically update Web pages  or at least parts of them

AJAX (model)

From W3Schools.com

AJAX Frameworks

 Most vendors have their own AJAX abstraction layers  ASP has a script manager and an AJAX toolkit  It’s a layer on top of AJAX  There are several for PHP  Phery, CJAX, Quicknet  There are frameworks for Python, Perl, Ruby and others

RestFull APIS

 Google has a number of APIs  These use JSON typically  JSON is an alternative to moving the responses around as XML

AJAX (The Mechanics)

 The XMLHttpRequest object is used to create a request  The request gets configured with the open method  The request gets sent with the send method  The responseText and responseXML properties store the returned information  Use the onreadystatechange event for async requests

AJAX XMLHttpRequest

(Example)

 Create open and send a synchronous request

AJAX Response (Synchronous)

 When the request completes, we get at the response through the following properties of the XMLHttpRequest object  responseText – gets the response data as a string  responseXML gets the response data as XML, which we can then parse using the DOM  This is the same DOM we talked about

AJAX Response

(Asynchronous)

 The onreadystatechanged event fires as the request progresses  Initialize  Loading  Loaded  Interactive  Completed  Status and status contain the result status information  404 – not found / 200 success docsity.com

AJAX Response

(Asynchronous)

A Few Words about XML

 It’s the extensible markup language  Data is frequently stored and transported as XML  It looks like XHTML 5  Tags, attributes and elements  Nesting concepts are the same  However the tag and attribute names can be any valid name  .NET knows about them

A Few Words about XML

 Sample XML document

REST

 For read requests we  Send all data to the server via a URL and GET request  URLs are a logical location, rather than a physical resource  Data is typically returned as XML  It’s not a standard but a way of doing things  An architecture of style  YQL is restful

A Few Words about YQL

 Yahoo Query Language  Implemented as a Web service, they maintain a number of tables  Finance  Geography and many more

http://developer.yahoo.com/yql/guide/yql- opentables-chapter.html#