1 / 12

AJAX

AJAX. CS456 Fall 2011. Examples. Where is AJAX used? Why do we care?. The web without AJAX. Why is this problematic/annoying?. The Web With AJAX. How does it do it?. It’s a new way to use the languages we already know A - Asynchronous J A X – XML Also uses DOM and CSS

kynton
Download Presentation

AJAX

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AJAX CS456 Fall 2011

  2. Examples • Where is AJAX used? • Why do we care?

  3. The web without AJAX • Why is this problematic/annoying?

  4. The Web With AJAX

  5. How does it do it? • It’s a new way to use the languages we already know • A - Asynchronous • J • A • X – XML • Also uses DOM and CSS • What server-side technologies? JavaScript (client-side)

  6. The overall process Client • Without AJAX we’d return an entire page • With AJAX it’s just one piece Need small amount of data from server Create XMLHttpRequest object Create a request in that object Send the request through that object Continue doing whatever user wants When receive response from server, update page Server Receive request Send information to client as XML

  7. Example • What is this technique doing? • What else can we do with the exact same simple approach?

  8. More Advanced Example • Instead of returning an html file and displaying all of it, we can send back specific sets of information and read it like a text file

  9. So what are all of these functions? • Properties of XMLHttpRequest Object:

  10. So what are all of these functions? • Methods of XMLHttpRequest Object:

  11. XML • You can return XML instead of text • Read it as if it is a document in the DOM • More complicated, and thus a lot of people don’t bother • JSON: textual way to represent objects in name-value pairs or arrays of values • Popular as a simpler alternative to XML • Faster to send than XML because files are smaller • Faster to parse than XML

  12. Client vs Server • What type of processing should happen on client? • What type of processing should happen on server? • What are our goals in deciding on server or client side? • How does AJAX help with achieving those goals?

More Related