Advanced Web Programming with JavaScript and Google Maps. Voronezh State University Voronezh (Russia) AJAX. Sergio Luján Mora

Similar documents
A.A. 2008/09. What is Ajax?



AJAX. Introduction. AJAX: Asynchronous JavaScript and XML

AJAX: The Basics CISC 282 March 25, 2014

Ajax. Ronald J. Glotzbach

An Introduction to AJAX. By : I. Moamin Abughazaleh

AJAX: The Basics CISC 282 November 22, 2017

AJAX: Introduction CISC 282 November 27, 2018

AJAX(Asynchronous Javascript + XML) Creating client-side dynamic Web pages

XMLHttpRequest. CS144: Web Applications

CITS1231 Web Technologies. Ajax and Web 2.0 Turning clunky website into interactive mashups

DOM. Ajax Technology in Web Programming. Sergio Luján Mora. DLSI - Universidad de Alicante 1. API for accessing and manipulating HTML documents

INDEX SYMBOLS See also

AJAX and PHP AJAX. Christian Wenz,

Session 11. Ajax. Reading & Reference

AJAX ASYNCHRONOUS JAVASCRIPT AND XML. Laura Farinetti - DAUIN

Term Paper. P r o f. D r. E d u a r d H e i n d l. H o c h s c h u l e F u r t w a n g e n U n i v e r s i t y. P r e s e n t e d T o :

It is highly recommended that you are familiar with HTML and JavaScript before attempting this tutorial.

2/6/2012. Rich Internet Applications. What is Ajax? Defining AJAX. Asynchronous JavaScript and XML Term coined in 2005 by Jesse James Garrett

Current Web Development

DOM. Contents. Sergio Luján Mora. What is DOM? DOM Levels DOM Level 0 DOM Level 1. Departamento de Lenguajes y Sistemas Informáticos

AJAX. Lecture 26. Robb T. Koether. Fri, Mar 21, Hampden-Sydney College. Robb T. Koether (Hampden-Sydney College) AJAX Fri, Mar 21, / 16

JavaScript CoAPRequest API

Web Application Security

Part of this connection identifies how the response can / should be provided to the client code via the use of a callback routine.

AJAX: Rich Internet Applications

Programming for Digital Media. Lecture 7 JavaScript By: A. Mousavi and P. Broomhead SERG, School of Engineering Design, Brunel University, UK

A synchronous J avascript A nd X ml

Contents. Demos folder: Demos\14-Ajax. 1. Overview of Ajax. 2. Using Ajax directly. 3. jquery and Ajax. 4. Consuming RESTful services

CS 5142 Scripting Languages

10.1 Overview of Ajax

Session 18. jquery - Ajax. Reference. Tutorials. jquery Methods. Session 18 jquery and Ajax 10/31/ Robert Kelly,

Developing Future Web Application with AJAX and ASP.NET Project "Atlas"

Introduction to Ajax

Module7: AJAX. Click, wait, and refresh user interaction. Synchronous request/response communication model. Page-driven: Workflow is based on pages

Fall Semester (081) Module7: AJAX

Use of PHP for DB Connection. Middle and Information Tier

/ Introduction to XML

AJAX. Ajax: Asynchronous JavaScript and XML *

E ECMAScript, 21 elements collection, HTML, 30 31, 31. Index 161

AJAX Programming Chris Seddon

Ajax- XMLHttpResponse. Returns a value such as ArrayBuffer, Blob, Document, JavaScript object, or a DOMString, based on the value of

Table of Contents. 1. A Quick Overview of Web Development...1 EVALUATION COPY

CSC Javascript

What is Ajax? History of web interaction (2/2) Google Maps (1/2) History of Ajax (I) A cleaning powder. A Dutch football team.

Ajax in Oracle JDeveloper

COPYRIGHTED MATERIAL. AJAX Technologies. Google Suggest

CSE 130 Programming Language Principles & Paradigms Lecture # 20. Chapter 13 Concurrency. + AJAX Discussion

1 Announcements (0:00 2:00) 2

Introduction to Ajax. Sang Shin Java Technology Architect Sun Microsystems, Inc.

Module 5 JavaScript, AJAX, and jquery. Module 5. Module 5 Contains 2 components

Lesson 12: JavaScript and AJAX

Session 11. Calling Servlets from Ajax. Lecture Objectives. Understand servlet response formats

ajax1.html 1/2 lectures/7/src/ ajax1.html 2/2 lectures/7/src/

Copyright Descriptor Systems, Course materials may not be reproduced in whole or in part without prior written consent of Joel Barnum

Use of PHP for DB Connection. Middle and Information Tier. Middle and Information Tier

Chapter 3: Web Paradigms and Interactivity

Ajax UNIX MAGAZINE if0505.pdf. (86) Ajax. Ajax. Ajax (Asynchronous JavaScript + XML) Jesse James Garrett Web 1. Web.

CSC 498: Web Programming

Web Programming/Scripting: PHP and AJAX Refresher

Asynchronous JavaScript + XML (Ajax)

Ajax or AJAX? The acronym AJAX has changed to the term Ajax, which does not represent specific technologies

Ajax. David Matuszek's presentation,

AJAX: From the Client-side with JavaScript, Back to the Server

Credits: Some of the slides are based on material adapted from

Ajax HTML5 Cookies. Sessions 1A and 1B

TIME SCHEDULE MODULE TOPICS PERIODS. HTML Document Object Model (DOM) and javascript Object Notation (JSON)

Module 5 JavaScript, AJAX, and jquery. Module 5. Module 5 Contains an Individual and Group component

Discussion #4 CSS VS XSLT. Multiple stylesheet types with cascading priorities. One stylesheet type

Chapter 1 Introduction to Computers and the Internet

AJAX Programming Overview. Introduction. Overview

CSC 405 Computer Security. Web Security

Index. Ray Nicholus 2016 R. Nicholus, Beyond jquery, DOI /

1 Explain the following in brief, with respect to usage of Ajax

Javascript. Many examples from Kyle Simpson: Scope and Closures

The course also includes an overview of some of the most popular frameworks that you will most likely encounter in your real work environments.

AJAX Basics. Welcome to AJAX Basics presentation. My name is Sang Shin. I am Java technology architect and evangelist from Sun Microsystems.

Getting Started. In this chapter

The Document Object Model (DOM) is a W3C standard. It defines a standard for accessing documents like HTML and XML.

CSC Web Technologies, Spring Web Data Exchange Formats

AJAX. Lab. de Bases de Dados e Aplicações Web MIEIC, FEUP 2010/11. Sérgio Nunes

Portlets and Ajax: Building More Dynamic Web Apps

REST AND AJAX. Introduction. Module 13

Introduction to AJAX Bringing Interactivity & Intuitiveness Into Web Applications. By : Bhanwar Gupta SD-Team-Member Jsoft Solutions

AJAX Workshop. Karen A. Coombs University of Houston Libraries Jason A. Clark Montana State University Libraries

AJAX เสถ ยร ห นตา ส าน กเทคโนโลย สารสนเทศและการส อสาร มหาว ทยาล ยนเรศวร พะเยา

Introduction to InfoSec SQLI & XSS (R10+11) Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)

Introduction to Ajax

JavaScript + PHP AJAX. Costantino Pistagna

Working with Database. Client-server sides AJAX JSON Data formats Working with JSON data Request Response Bytes Database

IT2353 WEB TECHNOLOGY Question Bank UNIT I 1. What is the difference between node and host? 2. What is the purpose of routers? 3. Define protocol. 4.

Abstract. 1. Introduction. 2. AJAX overview

CSC 337. JavaScript Object Notation (JSON) Rick Mercer

Using IBM Tivoli Monitoring V6.1 SOAP Services

JavaScript Specialist v2.0 Exam 1D0-735

Ajax Application Design

Javascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010

COMET, HTML5 WEBSOCKETS OVERVIEW OF WEB BASED SERVER PUSH TECHNOLOGIES. Comet HTML5 WebSockets. Peter R. Egli INDIGOO.COM. indigoo.com. 1/18 Rev. 2.

Outline. AJAX for Libraries. Jason A. Clark Head of Digital Access and Web Services Montana State University Libraries

Transcription:

with JavaScript and Google Maps Voronezh State University Voronezh (Russia) AJAX Sergio Luján Mora Departamento de Lenguajes y Sistemas Informáticos DLSI - Universidad de Alicante 1

Table of contents Two classical examples Introduction How it works XMLHttpRequest object AJAX step by step Sending data with GET/POST XML data format JSON data format More information Two classical examples EXERCISE A web page shows news headlines updated every 10 seconds DLSI - Universidad de Alicante 2

<html> <head> <title>news headlines</title> <meta http-equiv="refresh" content="10" /> </head> <body> <h1>news headlines</h1> <?php // Randomly generate between 1 and 10 news $n = rand(1, 10); for($i = 1; $i <= $n; $i++) { echo "<h2>news $i</h2>\n"; // Randomly repeat the string "Bla, bla, bla." between 1 and 5 times echo "<p>". str_repeat("bla, bla, bla.", rand(1, 5)). "</p>\n";?> </body> </html> Two classical examples EXERCISE A web page shows two lists (<select>): Initially, the second list is empty or it doesn t appear When selecting a value in the first list, the web page is reloaded and the second list shows new data DLSI - Universidad de Alicante 3

DLSI - Universidad de Alicante 4

DLSI - Universidad de Alicante 5

<html> <head><title>list of products</title></head> <body> <form action="" method="post"> <p> Family: <select name="family" onchange="submit()"> <option value="">select a family</option> <option value="1">computer</option> <option value="2">video</option> <option value="3">mobile phone</option> </select> <?php // Code for the second list with products?> </p> </form> </body> </html> Two classical examples <?php // Products for each family $products[1] = "<option>hp</option><option>dell</option>"; $products[2] = "<option>sony</option><option>panasonic</option>"; $products[3] = "<option>motorola</option><option>samsung</option>"; // Detects if there is a family // Detects if there is a family if(isset($_post["family"])) { echo '<select name="product">'; echo $products[$_post["family"]]; echo '</select>';?> DLSI - Universidad de Alicante 6

Introduction Client server architecture: The client request a service and the server provides the service Client part of the application only contains presentation logic and sometimes a small amount of business logic SERVER CLIENT Communication protocol Introduction Web applications: Based on client server architecture Every user interaction generates a server request and reloads the web page Sometimes, depending on the application and the user interface, too many requests can be generated Problems: Long waits of the client Slow applications Errors on the transmission DLSI - Universidad de Alicante 7

Introduction Ajax, shorthand h dfor Asynchronous JavaScript and XML. Web development technique for creating interactive web applications. The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user makes a change. This is meant to increase the web page's interactivity, speed, and usability. Introduction h fi k f h i bli The first known use of the term in public was by Jesse James Garrett in his February 2005 article Ajax: A New Approach to Web Applications. http://adaptivepath.com/publications/essa ys/archives/000385.php DLSI - Universidad de Alicante 8

Introduction The Ajax technique uses a combination of: XHTML (or HTML), CSS, for marking up and styling information. The DOM accessed with a client side scripting language, especially ECMAScript implementations such as JavaScript and JScript, to dynamically display and interact with the information presented. The XMLHttpRequest object to exchange data asynchronously with the web server. In some Ajax frameworks and in certain situations, an IFrame object is used instead of the XMLHttpRequest object to exchange data with the web server. XML is sometimes used as the format for transferring data between the server and client, although any format will work, including preformatted HTML, plain text, JSON and other formats. Like DHTML, LAMP, or SPA, Ajax is not a technology in itself, but a term that refers to the use of a group of technologies together. How it works A new layer, called Ajax engine, is inserted between the client and the server: XMLHttpRequest object is used This object communicates to the server The server response can be in different formats: Plain text HTML XML JSON DLSI - Universidad de Alicante 9

DLSI - Universidad de Alicante 10

Advantages Asynchronous transactions: users don t have to wait after a request Less amount of sent data Technologies based on open standards Similar to traditional applications in terms of interactivity and speed of response Disdvantages The number of requests against the server can increase There are some incompatibilities between browsers: The XMLHttpRequest object is not invoked in the same way in different browsers Loss of control over navigation: The back and forward buttons of the browser stops working Bookmarks to specific web pages can t be created, because it is always the same page There are some partial solutions DLSI - Universidad de Alicante 11

XMLHttpRequest XMLHttpRequest is an API that can be used by JavaScript, JScript, VBScript and other web browser scripting languages to transfer and manipulate XML data to and from a web server using HTTP, establishing an independent d connection channel between a web page's Client Side and Server Side. XMLHttpRequest The XMLHttpRequest concept was originally developed by Microsoft. The Microsoft implementation is called XMLHTTP and, as an ActiveX object, it differs from the published standard in a few small ways. It has been available lbl since Internet Explorer 5.0 and is accessible via JScript, VBScript and other scripting languages supported by IE browsers. DLSI - Universidad de Alicante 12

XMLHttpRequest The Mozilla project incorporated the first compatible native implementation of XMLHttpRequest in Mozilla 1.0 in 2002. This implementation waslater followed by Apple since Safari 1.2, Konqueror, Opera Software since Opera 8.0 and icab since 3.0b352. XMLHttpRequest The World ldwide Web WbConsortium published a Working Draft specification for the XMLHttpRequest object's API on 5 April 2006. While this is still a work in progress, its goal is "to document a minimum set of interoperable features based on existing implementations, allowing Web developers to use these features without platform specific code". The draft specification is based upon existing popular implementations, to help improve and ensure interoperability of code across web platforms. DLSI - Universidad de Alicante 13

XMLHttpRequest Methods: abort() getallresponseheaders() getresponseheader(header) open(method, url, asyncronous, user, password): send(content) setrequestheader(header, value) DLSI - Universidad de Alicante 14

XMLHttpRequest open(method, url, async, user, password): Initializes an XMLHTTP request. Specifies the method, URL, and authentication information forthe request. After calling this method, you must call send to send the request and data, if any, to the server. XMLHttpRequest send(content): Sends an HTTP request to the server and receives a response. null for no data. DLSI - Universidad de Alicante 15

Properties: onreadystatechange readystate responsetext responsexml status statustext XMLHttpRequest XMLHttpRequest onreadystatechange: Function than handles the different events. DLSI - Universidad de Alicante 16

readystate: XMLHttpRequest The property is read only. It represents the state of the request as an integer. Thefollowing values aredefined: XMLHttpRequest ( ) readystate: (W3C Recommendation) UNSENT (numeric value 0) The object has been constructed. OPENED (numeric value 1) The open() method has been successfully invoked. During this state request headers can be set using setrequestheader() and the request can be made using the send() method. HEADERS_RECEIVED (numeric value 2) All HTTP headers have been received. Several response members of the object are now available. LOADING (numeric value 3) The response entity body is being received. DONE (numeric value 4) The data transfer has been completed or something went wrong during the transfer (e.g. infinite redirects). DLSI - Universidad de Alicante 17

responsetext: XMLHttpRequest The property is read only. This property represents only one of several forms in which the HTTP response can be returned. responsexml: XMLHttpRequest The property is read only. This property represents the parsed response entity body. DLSI - Universidad de Alicante 18

status: XMLHttpRequest Return the HTTP status code. RFC 2616 Hypertext Transfer Protocol HTTP/1.1: http://www.w3.org/protocols/rfc2616/rfc2616 sec10.html 2xx Successful (200 OK) 3xx Redirection (301 Moved Permanently) 4xx Client error (404 Not Found) 5xx Server error (500 Internal Server Error) statustext: Return the HTTP status text. AJAX step by step 1. Create XMLHttpRequest object 2. Assign a function to the state change event 3. Send a request to the server 4. On a state change, manage the response 5. On a correct response, process the result and show to the user DLSI - Universidad de Alicante 19

Create XMLHttpRequest object Depending on the browser: Internet Explorer request = new ActiveXObject("Microsoft.XMLHTTP"); Other browsers: request = new XMLHttpRequest(); Code adapted for different browsers: if(window.xmlhttprequest) { request = new XMLHttpRequest(); else if(window.activexobject) { request = new ActiveXObject("Microsoft.XMLHTTP"); Create XMLHttpRequest object Another way, using exceptions: try { request = new ActiveXObject("Msxml2.XMLHTTP"); catch (e) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); catch (ee) { t { try { request = new XMLHttpRequest(); catch(eee) { alert("your browser doesn t support AJAX"); return; DLSI - Universidad de Alicante 20

Assign a function to the state change event This function will be called automatically, every time the state of the XMLHttpRequest object changes: request.onreadystatechange = nameoffunction; Important: without ( ), only the name Send a request to the server Open the connection, define the method and the type of connection: A synchronous connection (false) blocks the browser until the response is obtained An asynchronous connection (true and default value) executes on the background Important: the URL must belong to the same domain of the current page request.open('get','http://www.ua.es/ajax.jsp', true); Send the additional data: request.send(data or null); DLSI - Universidad de Alicante 21

On a state change, manage the response The handler is called every time there is a change: 0: UNSET 1: OPENED 2: HEADERS_RECEIVED 3: LOADING 4: DONE Example of handler: if (request.readystate == 4) { // Finished if (request.status==200) { // OK // Process the result else { // Not finished On a correct response, process the result and show to the user The result can be in different formats: plain text, HTML, JSON, XML, etc. responsetext when not structured result as XML: alert(request.responsetext); responsexml when structured t result as XML: Returns an XMLDocument object Use DOM functions DLSI - Universidad de Alicante 22

Example <script type="text/javascript"> function ajaxfunction() { var xmlhttp; if (window.xmlhttprequest) xmlhttp = new XMLHttpRequest(); else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate == 4) { document.myform.time.value += xmlhttp.responsetext + "\n"; xmlhttp.open("get","time.php",true); xmlhttp.send(null); </script> Example <script type="text/javascript"> function ajaxfunction() { var xmlhttp; if (window.xmlhttprequest) xmlhttp = new XMLHttpRequest(); else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); Create XMLHttpRequest object xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate == 4) { document.myform.time.value += xmlhttp.responsetext + "\n"; xmlhttp.open("get","time.php",true); xmlhttp.send(null); </script> DLSI - Universidad de Alicante 23

Example <script type="text/javascript"> function ajaxfunction() { var xmlhttp; if (window.xmlhttprequest) xmlhttp = new XMLHttpRequest(); else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); Assign a function to the state change event xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate == 4) { document.myform.time.value += xmlhttp.responsetext + "\n"; xmlhttp.open("get","time.php",true); xmlhttp.send(null); </script> Example <script type="text/javascript"> function ajaxfunction() { var xmlhttp; if (window.xmlhttprequest) xmlhttp = new XMLHttpRequest(); else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate == 4) { document.myform.time.value += xmlhttp.responsetext + "\n"; Send a request to the server xmlhttp.open("get","time.php",true); xmlhttp.send(null); </script> DLSI - Universidad de Alicante 24

Example <script type="text/javascript"> function ajaxfunction() { var xmlhttp; if (window.xmlhttprequest) xmlhttp = new XMLHttpRequest(); else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); On a state change, manage the response xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate == 4) { document.myform.time.value += xmlhttp.responsetext + "\n"; xmlhttp.open("get","time.php",true); xmlhttp.send(null); </script> Example <script type="text/javascript"> function ajaxfunction() { var xmlhttp; if (window.xmlhttprequest) xmlhttp = new XMLHttpRequest(); else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); On a correct response, process the result and show to the user xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate == 4) { document.myform.time.value += xmlhttp.responsetext + "\n"; xmlhttp.open("get","time.php",true); xmlhttp.send(null); </script> DLSI - Universidad de Alicante 25

Example <html> <head> <title>ajax example</title> <!-- script --> </head> <body> <form name="myform"> Name: <input type="text" onkeyup="ajaxfunction();" name="username" /> <br /> Time: <textarea name="time" cols="40" rows="10"></textarea> </form> </body> </html> Example PHP: <?php header("expires: -1"); $str1 = date('h:i:s A'); sleep(2); $str2 = date('h:i:s A'); echo "$str1 -- $str2";?> DLSI - Universidad de Alicante 26

Sending data GET/POST GET: Data is sent in the URL in the open() method encodeuricomponent() codes data to be sent in the URL var idfamily = document.getelementbyid("family").value; xmlhttp.open("get","productos.php?family=" + encodeuricomponent(idfamily), true); Sending data GET/POST POST: Data is sent in the send() method encodeuricomponent() codes data to be sent setrequestheader() is used to define some HTTP headers DLSI - Universidad de Alicante 27

Sending data GET/POST POST: var idfamily = document.getelementbyid("family").value; var parameters = "family=" + encodeuricomponent(idfamily); xmlhttp.open("post","products.php", true); xmlhttp.setrequestheader("content-type", "application/xwww-form-urlencoded"); xmlhttp.setrequestheader( setrequestheader("content-length", parameters.length); xmlhttp.setrequestheader("connection", "close"); xmlhttp.send(parameters); Transformation to AJAX Separate client and server logic HTML JavaScript DOM AJAX engine Client PHP Server DB DLSI - Universidad de Alicante 28

Transformation to AJAX EXERCISE Classical example (1): A web page shows news headlines updated every 10 seconds CLIENT New York Times Lastest news: Headline 1 Bla, bla, bla. Headline 2 Bla, bla, bla, bla, bla. AJAX SERVER <?php // News?> DLSI - Universidad de Alicante 29

Transformation to AJAX EXERCISE Classical example (2): A web page shows two lists (<select>): Initially, the second list is empty or it doesn t appear When selecting a value in the first list, the web page is reloaded and the second list shows new data XML data format Property responsexml XMLDocument object DOM properties and methods are used to access and traverse the XML document DLSI - Universidad de Alicante 30

XML data format Each node has a set of properties that t relates to its relatives : childnodes firstchild lastchild parentnode nextsibling prevsibling XML data format getelementbyid( elementid ) Useful to get a specific element var element = document.getelementbyid( mytable ) getelementsbytagname( tagname ): Useful to get a set of elements of the same type var images = document.getelementsbytagname( img ) The special value "*" all the tags (elements) getattribute( attrname ): var element = document.getelementbyid( mytable ). getattribute( width ); DLSI - Universidad de Alicante 31

XML data format xmldoc = xmlhttp.responsexml; x = xmldoc.documentelement.childnodes; for (i=0 ; i < x.length; i++) { document.write("nodename: " + x[i].nodename); document.write(" (nodetype: " + x[i].nodetype + ")<br />"); XML data format In the server, appropriate MIME type has to be used: <?php header("content-type: text/xml"); // O también header("content-type: application/xml"); header( Content Type: application/xml );?> DLSI - Universidad de Alicante 32

JSON data format JSON(JavaScript Object Notation) is a light exchange data format based on plain text JSON Specification RFC 4627: http://tools.ietf.org/html/rfc4627 org/html/rfc4627 JSON Validator: http://www.jsonlint.com/ JSON data format It s used to serialized structured data: Arrays: The list of values between square brackets ([ ]) and separated by commas (,) Objects: Pairs property/value closed between curly braces ({ ) and separated by commas Property and value are separated by colon In both cases, properties and values of string type must be between double quotes DLSI - Universidad de Alicante 33

Array example: JSON data format [1, 2, 3, 4, 5] ["Voronezh", "Moscow", "Saratov"] Object example: JSON data format {"name": "Sergio", "surnames": "Luján Mora" {"position": {"x": 10, "y": 20 DLSI - Universidad de Alicante 34

JSON data format Example: {"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateDoc()", {"value": "Open", "onclick": "OpenDoc()", {"value": "Close", "onclick": "CloseDoc()" ] JSON data format Example: { "Image": { "Width": 800, "Height": 600, "Title": "View from 15th Floor", "Thumbnail": { Thumbnail : { "Url": "http://www.ex.com/image/481989943", "Height": 125, "Width": "100" DLSI - Universidad de Alicante 35

JSON data format Data sent in JSON format is available in responsetext For rebuilding the original array or object, use eval(): var json_data = xmlhttp.responsetext; myobject = eval('(' + json_data + ')'); More information AJAX (Wikipedia): http://es.wikipedia.org/wiki/ajax Ajax: A New Approach to Web Applications: http://adaptivepath.com/publications/essays/archives/000385.php AJAX un nuevo acercamiento a aplicaciones web (traducción del anterior): http://www.uberbin.net/archivos/internet/ajax un nuevoacercamiento a aplicaciones web.php Hola mundo en Ajax: http://www.maestrosdelweb.com/editorial/ajaxpaso/ Introducción a Ajax: http://www.librosweb.es/ajax/index.html DLSI - Universidad de Alicante 36

More information W3C: The XMLHttpRequest Object (W3C Working Draft 05 April 2006) http://www.w3.org/tr/xmlhttprequest/ Microsoft: MSDN: IXMLHTTPRequest MSXML 4.0 SDK http://msdn.microsoft.com/library/default.asp?url =/library/enus/xmlsdk/html/xmobjxmlhttprequest.asp DLSI - Universidad de Alicante 37

DLSI - Universidad de Alicante 38