SlideShare a Scribd company logo
1 of 21
ARCHANA.M
II-MSC(CS)
DEPARTMENT OF CS & IT
NADAR SARASWATHI COLLEGE OF
ARTS AND SCIENCE
 Usability of web applications has lagged behind that of desktop applications
 Rich Internet Applications (RIAs)
-Web applications that approximate the look, feel and usability of desktop
applications
-Two key attributes—performance and rich GUI
 RIA performance
-Comes from Ajax (Asynchronous JavaScript and XML), which uses client-side
scripting to make web applications more responsive
Ajax applications separate client-side user interaction and server
communication, and run them in parallel, making the delays of server-
side processing more transparent to the user
“Raw” Ajax:
-uses JavaScript to send asynchronous requests to the server,
then updates the page using the DOM
-need to deal directly with cross-browser portability issues,
making it impractical for developing large-scale applications
Portability issues
-Hidden by Ajax toolkits, such as jQuery, ASP.NET Ajax and JSF’s Ajax
capabilities, which provide powerful ready-to-use controls and functions that
enrich web applications and simplify JavaScript coding by making it cross-
browser compatible.
Achieve rich GUI in RIAs with
-JavaScript toolkits, providing powerful ready-to-use controls and
functions that enrich web applications.
 Traditional web applications
-User fills in the form’s fields, then submits the form
-Browser generates a request to the server, which receives the request and processes it
-Server generates and sends a response containing the exact page that the browser will
render
-Browser loads the new page and temporarily makes the browser window blank
-Client waits for the server to respond and reloads the entire page with the data from the
response
In an Ajax application, when the user interacts with a page
-Client creates an XMLHttpRequest object to manage a request
-XMLHttpRequest object sends the request to and awaits the response
from the server
-Requests are asynchronous, allowing the user to continue interacting with
the application while the server processes the request concurrently
-When the server responds, the XMLHttpRequest object that issued the
request invokes a callback function, which typically uses partial page updates to
display the returned data in the existing web page without reloading the entire
page
 Classic HTML registration form
-Sends all of the data to be validated to the server when the user clicks the
Register button
-While the server is validating the data, the user cannot interact with the page
-Server finds invalid data, generates a new page identifying the errors in the
form and sends it back to the client—which renders the page in the browser
-User fixes the errors and clicks the Register button again
-Cycle repeats until no errors are found, then the data is stored on the server
-Entire page reloads every time the user submits invalid data
 Ajax-enabled forms are more interactive
-Entries are validated individually, dynamically as the user enters data into the
fields
-If a problem is found, the server sends an error message that is asynchronously
displayed to inform the user of the problem
-Sending each entry asynchronously allows the user to address invalid entries
quickly, rather than making edits and resubmitting the entire form repeatedly until all
entries are valid
-Asynchronous requests could also be used to fill some fields based on previous
fields’ values (e.g., city based on zip code)
 XMLHttpRequest object
-Resides on the client
-Is the layer between the client and the server that manages asynchronous
requests in Ajax applications
-Supported on most browsers, though they may implement it differently
 To initiate an asynchronous request
-Create an instance of the XMLHttpRequest object
-Use its open method to set up the request, and its send method to initiate the
request
When an Ajax application requests a file from a server, the browser
typically caches that file
-Subsequent requests for the same file can load it from the browser’s
cache
When the third argument to XMLHttpRequest method open is true, the
request is asynchronous
The following figures summarize some of the XMLHttpRequest object’s
properties and methods, respectively.
The properties are crucial to interacting with asynchronous requests.
The methods initialize, configure and send asynchronous requests.
The web application may interacts with a web service to obtain data and
to modify data in a server-side database.
The web application and server communicate with a data format called
JSON (JavaScript Object Notation).
The application executes server-side functions (or APIs) that occurs in
parallel with the user interacting with the web application.
JSON (JavaScript Object Notation)
-Simple way to represent JavaScript objects as strings
-A simpler alternative to XML for passing data between the client
and the server
-API in many programming languages
JSON object
-Represented as a list of property names and values contained in
curly braces
-{ "propertyName1" : value1, "propertyName2": value2 }
Array
-Represented in JSON with square brackets containing a comma-
separated list of values
-Each value in a JSON array can be a string, a number, a JSON
representation of an object, true, false or null
-"array_name“: [ { "propertyName1" : value1, "propertyName2":
value2 }, { "propertyName1" : value1, "propertyName2": value2 } ]
JSON strings
-Easier to create and parse than XML
-Require fewer bytes
-For these reasons, JSON is commonly used to
communicate in client/server interaction
Web service’s functions or APIs may returns a JSON
representation of an object or array of objects.
For example, when the web application requests the list of
names in the address book, the list is returned as a JSON array.
Address-book data formatted in JSON:
[ { "first": "Cheryl", "last": "Black" },
{ "first": "James", "last": "Blue" },
{ "first": "Mike", "last": "Brown" },
{ "first": "Meg", "last": "Gold" } ]
When the XMLHttpRequest object receives the response, it calls the
JSON.parse function, which converts the JSON string into a JavaScript
object
Ajax enabled rich internet applications with xml and json

More Related Content

What's hot

Active Server Page(ASP)
Active Server Page(ASP)Active Server Page(ASP)
Active Server Page(ASP)Keshab Nath
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentalsGopal Ji Singh
 
Enterprise java unit-3_chapter-1-jsp
Enterprise  java unit-3_chapter-1-jspEnterprise  java unit-3_chapter-1-jsp
Enterprise java unit-3_chapter-1-jspsandeep54552
 
Enterprise java unit-1_chapter-2
Enterprise java unit-1_chapter-2Enterprise java unit-1_chapter-2
Enterprise java unit-1_chapter-2sandeep54552
 
Application enumeration and launch
Application enumeration and launchApplication enumeration and launch
Application enumeration and launchPraveen Bakka
 
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl....net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...Nancy Thomas
 
Enterprise java unit-2_chapter-1
Enterprise  java unit-2_chapter-1Enterprise  java unit-2_chapter-1
Enterprise java unit-2_chapter-1sandeep54552
 
Liftweb
LiftwebLiftweb
LiftwebScalac
 
1. deploying an asp.net web application
1. deploying an asp.net web application1. deploying an asp.net web application
1. deploying an asp.net web applicationPramod Rathore
 
Introduction to React by Ebowe Blessing
Introduction to React by Ebowe BlessingIntroduction to React by Ebowe Blessing
Introduction to React by Ebowe BlessingBlessing Ebowe
 

What's hot (20)

Active Server Page(ASP)
Active Server Page(ASP)Active Server Page(ASP)
Active Server Page(ASP)
 
AJAX
AJAXAJAX
AJAX
 
Ajax
AjaxAjax
Ajax
 
Asp .net web form fundamentals
Asp .net web form fundamentalsAsp .net web form fundamentals
Asp .net web form fundamentals
 
Enterprise java unit-3_chapter-1-jsp
Enterprise  java unit-3_chapter-1-jspEnterprise  java unit-3_chapter-1-jsp
Enterprise java unit-3_chapter-1-jsp
 
Enterprise java unit-1_chapter-2
Enterprise java unit-1_chapter-2Enterprise java unit-1_chapter-2
Enterprise java unit-1_chapter-2
 
Ajax
AjaxAjax
Ajax
 
Asp.net web api
Asp.net web apiAsp.net web api
Asp.net web api
 
Application enumeration and launch
Application enumeration and launchApplication enumeration and launch
Application enumeration and launch
 
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl....net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
.net training | learn .net | Microsoft dot net Course | Microsoft dot net onl...
 
Enterprise java unit-2_chapter-1
Enterprise  java unit-2_chapter-1Enterprise  java unit-2_chapter-1
Enterprise java unit-2_chapter-1
 
Liftweb
LiftwebLiftweb
Liftweb
 
ASP.NET Lecture 1
ASP.NET Lecture 1ASP.NET Lecture 1
ASP.NET Lecture 1
 
Ajax
Ajax Ajax
Ajax
 
Asp dot net final (2)
Asp dot net   final (2)Asp dot net   final (2)
Asp dot net final (2)
 
1. deploying an asp.net web application
1. deploying an asp.net web application1. deploying an asp.net web application
1. deploying an asp.net web application
 
Angularjs & REST
Angularjs & RESTAngularjs & REST
Angularjs & REST
 
Introduction to React by Ebowe Blessing
Introduction to React by Ebowe BlessingIntroduction to React by Ebowe Blessing
Introduction to React by Ebowe Blessing
 
Anypoint connector basics
Anypoint connector basicsAnypoint connector basics
Anypoint connector basics
 
Batch processing
Batch processingBatch processing
Batch processing
 

Similar to Ajax enabled rich internet applications with xml and json

Similar to Ajax enabled rich internet applications with xml and json (20)

Ajax
AjaxAjax
Ajax
 
Ajax.ppt
Ajax.pptAjax.ppt
Ajax.ppt
 
Ajax
AjaxAjax
Ajax
 
25250716 seminar-on-ajax text
25250716 seminar-on-ajax text25250716 seminar-on-ajax text
25250716 seminar-on-ajax text
 
Ajax tutorial by bally chohan
Ajax tutorial by bally chohanAjax tutorial by bally chohan
Ajax tutorial by bally chohan
 
Ajax Ppt 1
Ajax Ppt 1Ajax Ppt 1
Ajax Ppt 1
 
Mashup
MashupMashup
Mashup
 
jQuery Ajax
jQuery AjaxjQuery Ajax
jQuery Ajax
 
Ajax
AjaxAjax
Ajax
 
AJAX
AJAXAJAX
AJAX
 
Ajax
AjaxAjax
Ajax
 
SynapseIndia dotnet development ajax client library
SynapseIndia dotnet development ajax client librarySynapseIndia dotnet development ajax client library
SynapseIndia dotnet development ajax client library
 
Ajax
AjaxAjax
Ajax
 
WEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptxWEB TECHNOLOGY Unit-5.pptx
WEB TECHNOLOGY Unit-5.pptx
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Ajax
AjaxAjax
Ajax
 
Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)Asynchronous JavaScript & XML (AJAX)
Asynchronous JavaScript & XML (AJAX)
 
Ajax.pdf
Ajax.pdfAjax.pdf
Ajax.pdf
 
Unit-5.pptx
Unit-5.pptxUnit-5.pptx
Unit-5.pptx
 
Ajax
AjaxAjax
Ajax
 

More from ArchanaMani2

Software evolution and Verification,validation
Software evolution and Verification,validationSoftware evolution and Verification,validation
Software evolution and Verification,validationArchanaMani2
 
Code scheduling constraints
Code scheduling constraintsCode scheduling constraints
Code scheduling constraintsArchanaMani2
 
Excellence in visulization
Excellence in visulizationExcellence in visulization
Excellence in visulizationArchanaMani2
 
Transaction management
Transaction managementTransaction management
Transaction managementArchanaMani2
 
Topological Sort and BFS
Topological Sort and BFSTopological Sort and BFS
Topological Sort and BFSArchanaMani2
 
Inheritance and overriding
Inheritance  and overridingInheritance  and overriding
Inheritance and overridingArchanaMani2
 

More from ArchanaMani2 (10)

Software evolution and Verification,validation
Software evolution and Verification,validationSoftware evolution and Verification,validation
Software evolution and Verification,validation
 
Code scheduling constraints
Code scheduling constraintsCode scheduling constraints
Code scheduling constraints
 
Excellence in visulization
Excellence in visulizationExcellence in visulization
Excellence in visulization
 
Firewall
FirewallFirewall
Firewall
 
The linux system
The linux systemThe linux system
The linux system
 
Big data
Big dataBig data
Big data
 
Transaction management
Transaction managementTransaction management
Transaction management
 
Topological Sort and BFS
Topological Sort and BFSTopological Sort and BFS
Topological Sort and BFS
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Inheritance and overriding
Inheritance  and overridingInheritance  and overriding
Inheritance and overriding
 

Recently uploaded

....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdfVikramadityaRaj
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPost Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPragya - UEM Kolkata Quiz Club
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfQucHHunhnh
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxheathfieldcps1
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17Celine George
 
factors influencing drug absorption-final-2.pptx
factors influencing drug absorption-final-2.pptxfactors influencing drug absorption-final-2.pptx
factors influencing drug absorption-final-2.pptxSanjay Shekar
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticspragatimahajan3
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptxmanishaJyala2
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45MysoreMuleSoftMeetup
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...Nguyen Thanh Tu Collection
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...Sayali Powar
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptxmansk2
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Celine George
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024CapitolTechU
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxCapitolTechU
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesRased Khan
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17Celine George
 
MichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdfMichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdfmstarkes24
 

Recently uploaded (20)

....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdfPost Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
Post Exam Fun(da) Intra UEM General Quiz 2024 - Prelims q&a.pdf
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17
 
factors influencing drug absorption-final-2.pptx
factors influencing drug absorption-final-2.pptxfactors influencing drug absorption-final-2.pptx
factors influencing drug absorption-final-2.pptx
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
Post Exam Fun(da) Intra UEM General Quiz - Finals.pdf
Post Exam Fun(da) Intra UEM General Quiz - Finals.pdfPost Exam Fun(da) Intra UEM General Quiz - Finals.pdf
Post Exam Fun(da) Intra UEM General Quiz - Finals.pdf
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17
 
MichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdfMichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdf
 

Ajax enabled rich internet applications with xml and json

  • 1. ARCHANA.M II-MSC(CS) DEPARTMENT OF CS & IT NADAR SARASWATHI COLLEGE OF ARTS AND SCIENCE
  • 2.  Usability of web applications has lagged behind that of desktop applications  Rich Internet Applications (RIAs) -Web applications that approximate the look, feel and usability of desktop applications -Two key attributes—performance and rich GUI  RIA performance -Comes from Ajax (Asynchronous JavaScript and XML), which uses client-side scripting to make web applications more responsive
  • 3. Ajax applications separate client-side user interaction and server communication, and run them in parallel, making the delays of server- side processing more transparent to the user “Raw” Ajax: -uses JavaScript to send asynchronous requests to the server, then updates the page using the DOM -need to deal directly with cross-browser portability issues, making it impractical for developing large-scale applications
  • 4. Portability issues -Hidden by Ajax toolkits, such as jQuery, ASP.NET Ajax and JSF’s Ajax capabilities, which provide powerful ready-to-use controls and functions that enrich web applications and simplify JavaScript coding by making it cross- browser compatible. Achieve rich GUI in RIAs with -JavaScript toolkits, providing powerful ready-to-use controls and functions that enrich web applications.
  • 5.  Traditional web applications -User fills in the form’s fields, then submits the form -Browser generates a request to the server, which receives the request and processes it -Server generates and sends a response containing the exact page that the browser will render -Browser loads the new page and temporarily makes the browser window blank -Client waits for the server to respond and reloads the entire page with the data from the response
  • 6. In an Ajax application, when the user interacts with a page -Client creates an XMLHttpRequest object to manage a request -XMLHttpRequest object sends the request to and awaits the response from the server -Requests are asynchronous, allowing the user to continue interacting with the application while the server processes the request concurrently -When the server responds, the XMLHttpRequest object that issued the request invokes a callback function, which typically uses partial page updates to display the returned data in the existing web page without reloading the entire page
  • 7.  Classic HTML registration form -Sends all of the data to be validated to the server when the user clicks the Register button -While the server is validating the data, the user cannot interact with the page -Server finds invalid data, generates a new page identifying the errors in the form and sends it back to the client—which renders the page in the browser -User fixes the errors and clicks the Register button again -Cycle repeats until no errors are found, then the data is stored on the server -Entire page reloads every time the user submits invalid data
  • 8.  Ajax-enabled forms are more interactive -Entries are validated individually, dynamically as the user enters data into the fields -If a problem is found, the server sends an error message that is asynchronously displayed to inform the user of the problem -Sending each entry asynchronously allows the user to address invalid entries quickly, rather than making edits and resubmitting the entire form repeatedly until all entries are valid -Asynchronous requests could also be used to fill some fields based on previous fields’ values (e.g., city based on zip code)
  • 9.  XMLHttpRequest object -Resides on the client -Is the layer between the client and the server that manages asynchronous requests in Ajax applications -Supported on most browsers, though they may implement it differently  To initiate an asynchronous request -Create an instance of the XMLHttpRequest object -Use its open method to set up the request, and its send method to initiate the request
  • 10. When an Ajax application requests a file from a server, the browser typically caches that file -Subsequent requests for the same file can load it from the browser’s cache When the third argument to XMLHttpRequest method open is true, the request is asynchronous
  • 11. The following figures summarize some of the XMLHttpRequest object’s properties and methods, respectively. The properties are crucial to interacting with asynchronous requests. The methods initialize, configure and send asynchronous requests.
  • 12.
  • 13.
  • 14.
  • 15. The web application may interacts with a web service to obtain data and to modify data in a server-side database. The web application and server communicate with a data format called JSON (JavaScript Object Notation). The application executes server-side functions (or APIs) that occurs in parallel with the user interacting with the web application.
  • 16. JSON (JavaScript Object Notation) -Simple way to represent JavaScript objects as strings -A simpler alternative to XML for passing data between the client and the server -API in many programming languages JSON object -Represented as a list of property names and values contained in curly braces -{ "propertyName1" : value1, "propertyName2": value2 }
  • 17. Array -Represented in JSON with square brackets containing a comma- separated list of values -Each value in a JSON array can be a string, a number, a JSON representation of an object, true, false or null -"array_name“: [ { "propertyName1" : value1, "propertyName2": value2 }, { "propertyName1" : value1, "propertyName2": value2 } ]
  • 18. JSON strings -Easier to create and parse than XML -Require fewer bytes -For these reasons, JSON is commonly used to communicate in client/server interaction
  • 19. Web service’s functions or APIs may returns a JSON representation of an object or array of objects. For example, when the web application requests the list of names in the address book, the list is returned as a JSON array.
  • 20. Address-book data formatted in JSON: [ { "first": "Cheryl", "last": "Black" }, { "first": "James", "last": "Blue" }, { "first": "Mike", "last": "Brown" }, { "first": "Meg", "last": "Gold" } ] When the XMLHttpRequest object receives the response, it calls the JSON.parse function, which converts the JSON string into a JavaScript object