SlideShare uma empresa Scribd logo
1 de 15
AJAX, JSON, AND
CLIENT SIDE TEMPLATES
AJAX
• Asynchronous Javascript And XML
  • HTML and CSS
  • Document Object Model
  • XML and XSLT
  • XMLHttpRequest
  • JavaScript
Web 1.0




          Example: www.ebay.ca
Web 2.0!




           Example: dhtmlxScheduler
JSON
• JavaScript Object Notation
   • Lightweight data-interchange format
   • Easy for humans to read and write
   • Easy for machines to parse and generate
JSON
• Built on two structures:
  • Name value pairs (aka object)
       { Name: “Value”, Name2: 2, Name3: true }


  • Ordered list of values (aka array)
       [ “value”, 2, true ]


  • Combination thereof
       [ { Name: “Object 1”, Numbers: [1,2,3] },
         { Name: “Object 2”, Numbers: [4,5,6] } ]

  • Virtually all languages support these structures
JSON vs XML
JSON vs XML
Old HTML Way
               Page,
               ViewPerPage, ID
               Search,
               Name Search,
               SKU Search, Price
               From,
               Price To, Position
               From, Position To
AJAX Partial Rendering Way

                ID Search,
                Name Search,
                SKU Search,
                Price From,
                Price To, Position
                From, Position To
Client Side Templates


                                         GET /Products?Page=2




   [ {Product}, {Product}, {Product} ]
Client Side Templates
• Pros
  • Separation of data and layout
  • Faster page load
    • No wait time on server, simply serving up a HTML document
    • Less content
  • Less network traffic
    • Smaller requests and responses
  • Server doesn’t have to worry about generating HTML
  • Able to maintain page state in JavaScript if needed
  • Lots of opportunities to cache
Client Side Templates
• Cons
  • Initial page load is essentially empty
     • Bad idea for pages you want indexed by a search engine
  • JavaScript heavy
  • No canned controls
  • Async can be tough on groups of objects or sequential operations
Example!



           http://localhost:8080/Playlists
Questions!?

Mais conteúdo relacionado

Mais procurados

Mais procurados (19)

Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 
Css3 Presetation
Css3 PresetationCss3 Presetation
Css3 Presetation
 
Ajax
AjaxAjax
Ajax
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
Comparisons of web languages
Comparisons of web languagesComparisons of web languages
Comparisons of web languages
 
Web Scraping Technologies
Web Scraping TechnologiesWeb Scraping Technologies
Web Scraping Technologies
 
An Introduction to Ajax Programming
An Introduction to Ajax ProgrammingAn Introduction to Ajax Programming
An Introduction to Ajax Programming
 
Ajax Presentation
Ajax PresentationAjax Presentation
Ajax Presentation
 
Ajax
AjaxAjax
Ajax
 
Ajax.ppt
Ajax.pptAjax.ppt
Ajax.ppt
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
MongoDB at CodeMash 2.0.1.0
MongoDB at CodeMash 2.0.1.0MongoDB at CodeMash 2.0.1.0
MongoDB at CodeMash 2.0.1.0
 
AJAX
AJAXAJAX
AJAX
 
Ajax Ppt 1
Ajax Ppt 1Ajax Ppt 1
Ajax Ppt 1
 
Ajax:From Desktop Applications towards Ajax Web Applications
Ajax:From Desktop Applications towards Ajax Web ApplicationsAjax:From Desktop Applications towards Ajax Web Applications
Ajax:From Desktop Applications towards Ajax Web Applications
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
Ajax Introduction Presentation
Ajax   Introduction   PresentationAjax   Introduction   Presentation
Ajax Introduction Presentation
 
Bulletproof Ajax
Bulletproof AjaxBulletproof Ajax
Bulletproof Ajax
 
Introduction to ajax
Introduction  to  ajaxIntroduction  to  ajax
Introduction to ajax
 

Semelhante a AJAX, JSON, and Client-Side Templates

Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajaxNir Elbaz
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)Talha Ocakçı
 
AWS Public Data Sets: How to Stage Petabytes of Data for Analysis in AWS (WPS...
AWS Public Data Sets: How to Stage Petabytes of Data for Analysis in AWS (WPS...AWS Public Data Sets: How to Stage Petabytes of Data for Analysis in AWS (WPS...
AWS Public Data Sets: How to Stage Petabytes of Data for Analysis in AWS (WPS...Amazon Web Services
 
Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2kriszyp
 
SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...Liam Cleary [MVP]
 
SharePoint REST vs CSOM
SharePoint REST vs CSOMSharePoint REST vs CSOM
SharePoint REST vs CSOMMark Rackley
 
Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007ClubHack
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorialKat Roque
 
AJAX Introduction [Autosaved].pptx
AJAX Introduction [Autosaved].pptxAJAX Introduction [Autosaved].pptx
AJAX Introduction [Autosaved].pptxJobin86
 
Web technologies-course 10.pptx
Web technologies-course 10.pptxWeb technologies-course 10.pptx
Web technologies-course 10.pptxStefan Oprea
 
Ajax Introduction
Ajax IntroductionAjax Introduction
Ajax IntroductionOliver Cai
 

Semelhante a AJAX, JSON, and Client-Side Templates (20)

Ajax
AjaxAjax
Ajax
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Ajax workshop
Ajax workshopAjax workshop
Ajax workshop
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)
 
AWS Public Data Sets: How to Stage Petabytes of Data for Analysis in AWS (WPS...
AWS Public Data Sets: How to Stage Petabytes of Data for Analysis in AWS (WPS...AWS Public Data Sets: How to Stage Petabytes of Data for Analysis in AWS (WPS...
AWS Public Data Sets: How to Stage Petabytes of Data for Analysis in AWS (WPS...
 
REST easy with API Platform
REST easy with API PlatformREST easy with API Platform
REST easy with API Platform
 
Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2
 
Building a spa_in_30min
Building a spa_in_30minBuilding a spa_in_30min
Building a spa_in_30min
 
Building a spa_in_30min
Building a spa_in_30minBuilding a spa_in_30min
Building a spa_in_30min
 
SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...SharePoint Saturday The Conference DC - How the client object model saved the...
SharePoint Saturday The Conference DC - How the client object model saved the...
 
Ajax Lecture Notes
Ajax Lecture NotesAjax Lecture Notes
Ajax Lecture Notes
 
PHP - Introduction to PHP AJAX
PHP -  Introduction to PHP AJAXPHP -  Introduction to PHP AJAX
PHP - Introduction to PHP AJAX
 
SharePoint REST vs CSOM
SharePoint REST vs CSOMSharePoint REST vs CSOM
SharePoint REST vs CSOM
 
Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
 
Ajax
AjaxAjax
Ajax
 
AJAX Introduction [Autosaved].pptx
AJAX Introduction [Autosaved].pptxAJAX Introduction [Autosaved].pptx
AJAX Introduction [Autosaved].pptx
 
Web technologies-course 10.pptx
Web technologies-course 10.pptxWeb technologies-course 10.pptx
Web technologies-course 10.pptx
 
Introduction to AJAX
Introduction to AJAXIntroduction to AJAX
Introduction to AJAX
 
Ajax Introduction
Ajax IntroductionAjax Introduction
Ajax Introduction
 

Mais de RTigger

You Can't Buy Agile
You Can't Buy AgileYou Can't Buy Agile
You Can't Buy AgileRTigger
 
Caching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' PerformanceCaching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' PerformanceRTigger
 
Ready, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming languageReady, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming languageRTigger
 
Open source web services
Open source web servicesOpen source web services
Open source web servicesRTigger
 
How to hire a hacker
How to hire a hackerHow to hire a hacker
How to hire a hackerRTigger
 
Windows 8 programming with html and java script
Windows 8 programming with html and java scriptWindows 8 programming with html and java script
Windows 8 programming with html and java scriptRTigger
 
Open regina
Open reginaOpen regina
Open reginaRTigger
 
Single page apps and the web of tomorrow
Single page apps and the web of tomorrowSingle page apps and the web of tomorrow
Single page apps and the web of tomorrowRTigger
 
Async in .NET
Async in .NETAsync in .NET
Async in .NETRTigger
 
Give your web apps some backbone
Give your web apps some backboneGive your web apps some backbone
Give your web apps some backboneRTigger
 
Hackers, hackathons, and you
Hackers, hackathons, and youHackers, hackathons, and you
Hackers, hackathons, and youRTigger
 
JavaScript!
JavaScript!JavaScript!
JavaScript!RTigger
 
Parallel Processing
Parallel ProcessingParallel Processing
Parallel ProcessingRTigger
 
Reactive Extensions
Reactive ExtensionsReactive Extensions
Reactive ExtensionsRTigger
 
Sql vs NoSQL
Sql vs NoSQLSql vs NoSQL
Sql vs NoSQLRTigger
 
Git’in Jiggy With Git
Git’in Jiggy With GitGit’in Jiggy With Git
Git’in Jiggy With GitRTigger
 
What The F#
What The F#What The F#
What The F#RTigger
 
Web Services
Web ServicesWeb Services
Web ServicesRTigger
 
Total Engagement
Total EngagementTotal Engagement
Total EngagementRTigger
 

Mais de RTigger (20)

You Can't Buy Agile
You Can't Buy AgileYou Can't Buy Agile
You Can't Buy Agile
 
Caching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' PerformanceCaching up is hard to do: Improving your Web Services' Performance
Caching up is hard to do: Improving your Web Services' Performance
 
Ready, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming languageReady, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming language
 
Open source web services
Open source web servicesOpen source web services
Open source web services
 
How to hire a hacker
How to hire a hackerHow to hire a hacker
How to hire a hacker
 
Windows 8 programming with html and java script
Windows 8 programming with html and java scriptWindows 8 programming with html and java script
Windows 8 programming with html and java script
 
Open regina
Open reginaOpen regina
Open regina
 
Single page apps and the web of tomorrow
Single page apps and the web of tomorrowSingle page apps and the web of tomorrow
Single page apps and the web of tomorrow
 
Async in .NET
Async in .NETAsync in .NET
Async in .NET
 
Give your web apps some backbone
Give your web apps some backboneGive your web apps some backbone
Give your web apps some backbone
 
Hackers, hackathons, and you
Hackers, hackathons, and youHackers, hackathons, and you
Hackers, hackathons, and you
 
JavaScript!
JavaScript!JavaScript!
JavaScript!
 
Parallel Processing
Parallel ProcessingParallel Processing
Parallel Processing
 
Node.js
Node.jsNode.js
Node.js
 
Reactive Extensions
Reactive ExtensionsReactive Extensions
Reactive Extensions
 
Sql vs NoSQL
Sql vs NoSQLSql vs NoSQL
Sql vs NoSQL
 
Git’in Jiggy With Git
Git’in Jiggy With GitGit’in Jiggy With Git
Git’in Jiggy With Git
 
What The F#
What The F#What The F#
What The F#
 
Web Services
Web ServicesWeb Services
Web Services
 
Total Engagement
Total EngagementTotal Engagement
Total Engagement
 

Último

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 

Último (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 

AJAX, JSON, and Client-Side Templates

  • 1. AJAX, JSON, AND CLIENT SIDE TEMPLATES
  • 2. AJAX • Asynchronous Javascript And XML • HTML and CSS • Document Object Model • XML and XSLT • XMLHttpRequest • JavaScript
  • 3. Web 1.0 Example: www.ebay.ca
  • 4. Web 2.0! Example: dhtmlxScheduler
  • 5. JSON • JavaScript Object Notation • Lightweight data-interchange format • Easy for humans to read and write • Easy for machines to parse and generate
  • 6. JSON • Built on two structures: • Name value pairs (aka object) { Name: “Value”, Name2: 2, Name3: true } • Ordered list of values (aka array) [ “value”, 2, true ] • Combination thereof [ { Name: “Object 1”, Numbers: [1,2,3] }, { Name: “Object 2”, Numbers: [4,5,6] } ] • Virtually all languages support these structures
  • 9. Old HTML Way Page, ViewPerPage, ID Search, Name Search, SKU Search, Price From, Price To, Position From, Position To
  • 10. AJAX Partial Rendering Way ID Search, Name Search, SKU Search, Price From, Price To, Position From, Position To
  • 11. Client Side Templates GET /Products?Page=2 [ {Product}, {Product}, {Product} ]
  • 12. Client Side Templates • Pros • Separation of data and layout • Faster page load • No wait time on server, simply serving up a HTML document • Less content • Less network traffic • Smaller requests and responses • Server doesn’t have to worry about generating HTML • Able to maintain page state in JavaScript if needed • Lots of opportunities to cache
  • 13. Client Side Templates • Cons • Initial page load is essentially empty • Bad idea for pages you want indexed by a search engine • JavaScript heavy • No canned controls • Async can be tough on groups of objects or sequential operations
  • 14. Example! http://localhost:8080/Playlists

Notas do Editor

  1. DOM – represents the document as an object,used to create and manipulate elements on a webpageXML – initial standard for transmitting data to and from a web serviceXMLHttpRequest – component that allows a browser to send a web request independent of a page request
  2. The blanks on the client side represent page loading, waiting on the server, and a locked UISystem processing includes processing the request input (viewstate, cookies, authentication, get & post vars), any database or other resource calls necessary to create the page, and the actual generation of the HTML to send to the client
  3. Ajax allows a consistent and responsive user experienceAjax engine runs on a separate thread from the UI and sends and receives data in the backgroundServer is now only responsible for processing input, making any resource calls it needs, and sending data as output
  4. Example result from twitter search APIExtra “fat” in XML:Schema definitionsTag syntaxEscaped XML characters
  5. Same result from twitter search APIMorereadable, no unnecessary content
  6. The entire form’s content is transmitted every request, and the entire page’s content is rendered on the server and transmitted every response
  7. Only the required fields (or at least a subset of all the fields) is sent in the request, and only the affected area(s) of the page are rendered and sent in the response
  8. Initially, the server only sends you the static controls for a page, as well as templates for how to represent the data it’s about to receiveThe browser, once loaded, makes a request for the data to displayThe server processes the request and sends back only the data requestedThe browser combines the data from the server with the client-side template to build the rest of the webpage
  9. Client Side Templates is a good idea for dynamic, task-driven web applications. It’s not a good idea for blogs, corporate websites, or anything that is mostly static content that needs to be indexed.
  10. Start website with debug attached to slow down requestsPoint out how fast initial page loaded (net panel)Show how we’re making three API calls after the page loadsDemonstrate client side template (view source), and then data received from API (catalog call), and finally how it looks on pageShow how categories works now that products are loaded locallyShow how loading a playlist worksShow how an add operation works (drag product to playlist)Show how a bulk operation might work