SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
The Web: Concepts and Technology

                              Web Services (conclusion)
                                      Feb 19




1
    Eugene Agichtein   CS 190: The Web: Concepts and Technology, Emory University   Spring 2009
Today’s Plan
       Web Services
          JSON (review/summary)
          XML




2
    Eugene Agichtein   CS 190: The Web: Concepts and Technology, Emory University   Spring 2009
AJAX (Asynchronous Javascript + XML)
         (A    h       J      i t
       Uses browser’s XML support: DOM, XSLT
       XMLHttpRequest
       Google Maps is best-known AJAX application




3
    Agichtein for Emory CS171, Spring 2008
AJAX Design Principles
       The browser hosts an application, not content
         Application d delivered to b
         A li i code d li           d browser, mostly as J S i
                                                      l    JavaScript
         code
       The server delivers data, not content
         Data may be plain text, JavaScript fragments, or XML
         documents
       User/application interaction is continuous and fluid
          UI metaphors like drag-and-drop become possible
       This is real coding and requires discipline
         Significant developer responsibility to manage conversational
         state over entire web transaction


4
    Agichtein for Emory CS171, Spring 2008
Basic AJAX process




5
    Agichtein for Emory CS171, Spring 2008
JSON in Ajax
       HTML Delivery.

       JSON data is built into the page.
           <html>...
           <script>
           var data = { ... JSONdata ... };




6
    Agichtein for Emory CS171, Spring 2008
JSON in Ajax
       XMLHttpRequest
           Obtain responseText
           Parse the responseText

              responseData = eval(
                  '(' + responseText + ')');

              responseData =
                  responseText.parseJSON();




7
    Agichtein for Emory CS171, Spring 2008
JSON in Ajax
       Secret <iframe>
       Request data using form.submit to the
       <iframe> target.
       The server sends the JSON text embedded in a script in
       a document.
           <html><head><script>
            h l h d        i
           document.domain = 'penzance.com';
           parent.deliver({ ... JSONtext ... });
           </script></head></html>
       The function deliver is passed the value.
                               p
8
    Agichtein for Emory CS171, Spring 2008
JSON in Ajax
       Dynamic script tag hack.
       Create a script node. The src url makes the request.
       The server sends the JSON text embedded in a script.
           deliver({ ... JSONtext ... });
       The function deliver is passed the value.
       The dynamic script tag hack is insecure.
            y          p g




9
    Agichtein for Emory CS171, Spring 2008
JSONRequest
      A new facility.
      Two way data interchange between any page and any server.
      Exempt from the Same Origin Policy.
      Campaign to make a standard feature of all browsers.

     http://www.JSON.org/JSONRequest.html




10
      Agichtein for Emory CS171, Spring 2008
Yahoo Web Service with JSON
        Tutorial/Howto:
            http://developer.yahoo.com/common/json.html
            h      d l         h                   h l
        Can use nice interface widgets:
        http://developer.yahoo.com/yui/index.html
                           y           y
        http://developer.yahoo.com/yui/examples/datatable/dt_xhrjson.html




11
     Agichtein for Emory CS171, Spring 2008
jQuery Library
        http://jquery.com

       Usage: same as YUI
     <html>
       head
      <head>
       <script type="text/javascript" src="jquery.js"></script>
       <script type="text/javascript">
        // Your code goes here
                     g
       </script>
      </head>
           y
      <body>
       <a href="http://jquery.com/">jQuery</a>
      </body>
     </html>

12
     Eugene Agichtein   CS 190: The Web: Concepts and Technology, Emory University   Spring 2009
Google Maps API
     http://code.google.com/apis/maps/

http://cs190.mathcs.emory.edu/~cs190000/project1/maps.html




13
        Eugene Agichtein   CS 190: The Web: Concepts and Technology, Emory University   Spring 2009

Mais conteúdo relacionado

Mais procurados

Mais procurados (19)

Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
 
Rawnet Lightning Talk - Web Components
Rawnet Lightning Talk - Web ComponentsRawnet Lightning Talk - Web Components
Rawnet Lightning Talk - Web Components
 
The spring ecosystem in 50 min
The spring ecosystem in 50 minThe spring ecosystem in 50 min
The spring ecosystem in 50 min
 
Performance optimisation with GraphQL
Performance optimisation with GraphQLPerformance optimisation with GraphQL
Performance optimisation with GraphQL
 
Re-Learning JavaScript
Re-Learning JavaScriptRe-Learning JavaScript
Re-Learning JavaScript
 
GraphQL
GraphQLGraphQL
GraphQL
 
Wrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQLWrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQL
 
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
 
Using REST and XML Builder for legacy XML
Using REST and XML Builder for legacy XMLUsing REST and XML Builder for legacy XML
Using REST and XML Builder for legacy XML
 
[React Native Tutorial] Lecture 6: Component, Props, and Network
[React Native Tutorial] Lecture 6: Component, Props, and Network[React Native Tutorial] Lecture 6: Component, Props, and Network
[React Native Tutorial] Lecture 6: Component, Props, and Network
 
Single-Page Lab - ASNApalooza 2014
Single-Page Lab - ASNApalooza 2014Single-Page Lab - ASNApalooza 2014
Single-Page Lab - ASNApalooza 2014
 
Creating asynchronous flows on AWS
Creating asynchronous flows on AWSCreating asynchronous flows on AWS
Creating asynchronous flows on AWS
 
ASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server ControlsASP.NET 03 - Working With Web Server Controls
ASP.NET 03 - Working With Web Server Controls
 
Modular GraphQL with Schema Stitching
Modular GraphQL with Schema StitchingModular GraphQL with Schema Stitching
Modular GraphQL with Schema Stitching
 
Better APIs with GraphQL
Better APIs with GraphQL Better APIs with GraphQL
Better APIs with GraphQL
 
Creating web api and consuming- part 1
Creating web api and consuming- part 1Creating web api and consuming- part 1
Creating web api and consuming- part 1
 
From ActiveRecord to EventSourcing
From ActiveRecord to EventSourcingFrom ActiveRecord to EventSourcing
From ActiveRecord to EventSourcing
 
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai vistoKLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
KLab 2019 Meetup - TypeScript come (forse) non lo hai mai visto
 

Destaque (6)

jquery
jqueryjquery
jquery
 
pscs3vqp_excerpt
pscs3vqp_excerptpscs3vqp_excerpt
pscs3vqp_excerpt
 
10 Mitow Pozycjonowania
10 Mitow Pozycjonowania10 Mitow Pozycjonowania
10 Mitow Pozycjonowania
 
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_LeopardAdding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard
 
Tanzani anestor
Tanzani anestorTanzani anestor
Tanzani anestor
 
Panel de solutions javascript
Panel de solutions javascriptPanel de solutions javascript
Panel de solutions javascript
 

Semelhante a feb19-webservices3

AJAX
AJAXAJAX
AJAX
ARJUN
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applications
dominion
 
An Introduction to Ajax Programming
An Introduction to Ajax ProgrammingAn Introduction to Ajax Programming
An Introduction to Ajax Programming
hchen1
 

Semelhante a feb19-webservices3 (20)

CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2CTS Conference Web 2.0 Tutorial Part 2
CTS Conference Web 2.0 Tutorial Part 2
 
AJAX
AJAXAJAX
AJAX
 
M Ramya
M RamyaM Ramya
M Ramya
 
Walther Ajax4
Walther Ajax4Walther Ajax4
Walther Ajax4
 
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
 
Apache Aries Blog Sample
Apache Aries Blog SampleApache Aries Blog Sample
Apache Aries Blog Sample
 
08 ajax
08 ajax08 ajax
08 ajax
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Introduction about-ajax-framework
Introduction about-ajax-frameworkIntroduction about-ajax-framework
Introduction about-ajax-framework
 
Ajax
AjaxAjax
Ajax
 
SAX - Android Development
SAX - Android DevelopmentSAX - Android Development
SAX - Android Development
 
Using Ajax In Domino Web Applications
Using Ajax In Domino Web ApplicationsUsing Ajax In Domino Web Applications
Using Ajax In Domino Web Applications
 
Building Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan DieboltBuilding Smart Workflows - Dan Diebolt
Building Smart Workflows - Dan Diebolt
 
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
Moving to the Client - JavaFX and HTML5 (PowerPoint Version)
 
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnitWriting and Testing JavaScript-heavy Web 2.0 apps with JSUnit
Writing and Testing JavaScript-heavy Web 2.0 apps with JSUnit
 
An Introduction to Ajax Programming
An Introduction to Ajax ProgrammingAn Introduction to Ajax Programming
An Introduction to Ajax Programming
 
Presentation Tier optimizations
Presentation Tier optimizationsPresentation Tier optimizations
Presentation Tier optimizations
 
Ajax and Jquery
Ajax and JqueryAjax and Jquery
Ajax and Jquery
 
Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easy
 

Mais de tutorialsruby

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 

Mais de tutorialsruby (20)

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

feb19-webservices3

  • 1. The Web: Concepts and Technology Web Services (conclusion) Feb 19 1 Eugene Agichtein CS 190: The Web: Concepts and Technology, Emory University Spring 2009
  • 2. Today’s Plan Web Services JSON (review/summary) XML 2 Eugene Agichtein CS 190: The Web: Concepts and Technology, Emory University Spring 2009
  • 3. AJAX (Asynchronous Javascript + XML) (A h J i t Uses browser’s XML support: DOM, XSLT XMLHttpRequest Google Maps is best-known AJAX application 3 Agichtein for Emory CS171, Spring 2008
  • 4. AJAX Design Principles The browser hosts an application, not content Application d delivered to b A li i code d li d browser, mostly as J S i l JavaScript code The server delivers data, not content Data may be plain text, JavaScript fragments, or XML documents User/application interaction is continuous and fluid UI metaphors like drag-and-drop become possible This is real coding and requires discipline Significant developer responsibility to manage conversational state over entire web transaction 4 Agichtein for Emory CS171, Spring 2008
  • 5. Basic AJAX process 5 Agichtein for Emory CS171, Spring 2008
  • 6. JSON in Ajax HTML Delivery. JSON data is built into the page. <html>... <script> var data = { ... JSONdata ... }; 6 Agichtein for Emory CS171, Spring 2008
  • 7. JSON in Ajax XMLHttpRequest Obtain responseText Parse the responseText responseData = eval( '(' + responseText + ')'); responseData = responseText.parseJSON(); 7 Agichtein for Emory CS171, Spring 2008
  • 8. JSON in Ajax Secret <iframe> Request data using form.submit to the <iframe> target. The server sends the JSON text embedded in a script in a document. <html><head><script> h l h d i document.domain = 'penzance.com'; parent.deliver({ ... JSONtext ... }); </script></head></html> The function deliver is passed the value. p 8 Agichtein for Emory CS171, Spring 2008
  • 9. JSON in Ajax Dynamic script tag hack. Create a script node. The src url makes the request. The server sends the JSON text embedded in a script. deliver({ ... JSONtext ... }); The function deliver is passed the value. The dynamic script tag hack is insecure. y p g 9 Agichtein for Emory CS171, Spring 2008
  • 10. JSONRequest A new facility. Two way data interchange between any page and any server. Exempt from the Same Origin Policy. Campaign to make a standard feature of all browsers. http://www.JSON.org/JSONRequest.html 10 Agichtein for Emory CS171, Spring 2008
  • 11. Yahoo Web Service with JSON Tutorial/Howto: http://developer.yahoo.com/common/json.html h d l h h l Can use nice interface widgets: http://developer.yahoo.com/yui/index.html y y http://developer.yahoo.com/yui/examples/datatable/dt_xhrjson.html 11 Agichtein for Emory CS171, Spring 2008
  • 12. jQuery Library http://jquery.com Usage: same as YUI <html> head <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> // Your code goes here g </script> </head> y <body> <a href="http://jquery.com/">jQuery</a> </body> </html> 12 Eugene Agichtein CS 190: The Web: Concepts and Technology, Emory University Spring 2009
  • 13. Google Maps API http://code.google.com/apis/maps/ http://cs190.mathcs.emory.edu/~cs190000/project1/maps.html 13 Eugene Agichtein CS 190: The Web: Concepts and Technology, Emory University Spring 2009