SlideShare a Scribd company logo
1 of 39
Download to read offline
AJAX
                           CRIA Webtechnology
Thursday, March 18, 2010
Some applications of AJAX
 2

          Validation
          Dynamic listboxes
          Autorefresh
          Excessive tooltips
          Calling webservices




                           CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
AJAX
 3

          Asynchronous Javascript And XML

          No DOM Standard, equals implementation in several
           browsers through the XMLHttpRequest




                           CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest
 4



       AJAX Enabled Web App.                            Webserver

                                                                      Server
                                                                      Resource
          XHR
                           function callback()
                           {
           2               }
                                                        Databaseserver



          event                                                       DB




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest
 4



       AJAX Enabled Web App.                            Webserver

                                                                      Server
                                                                      Resource
          XHR
                           function callback()
                           {
           2               }
                                                        Databaseserver


                            1                                         DB
          event




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest
 4



       AJAX Enabled Web App.                            Webserver
                                                   3
                                                                      Server
                                                                      Resource
          XHR
                           function callback()
                           {
           2               }
                                                        Databaseserver


                            1                                         DB
          event




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest
 4



       AJAX Enabled Web App.                            Webserver
                                                   3
                                                                      Server
                                                                      Resource
          XHR
                           function callback()
                           {                                                     4
           2               }
                                                        Databaseserver


                            1                                         DB
          event




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest
 4



       AJAX Enabled Web App.                            Webserver
                                                   3
                                                                      Server
                                                                      Resource
          XHR
                                                   5
                           function callback()
                           {                                                     4
           2               }
                                                        Databaseserver


                            1                                         DB
          event




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest
 4



       AJAX Enabled Web App.                            Webserver
                                                   3
                                                                      Server
                                                                      Resource
          XHR
                                                   5
                           function callback()
                           {                                                     4
           2               }            6
                                                        Databaseserver


                            1                                         DB
          event




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest
 5
           HTML:
       <div id="emailSection">
               <input id="email" type="text"
                 onblur="new
                  ValidationServiceRequestor().validateEmail();"/>
               <label>Emailadres</label>
       </div>

       JAVASCRIPT:
       var ValidationServiceRequestor = function(){
       	    this.validateEmail = function(){
       	    	    var emailaddress = document.getElementById("email");
       	    	    var serviceProxy = new ValidationServiceProxy(this);
       	    	    serviceProxy.validateEmail(emailaddress);
       	    }
       	    this.setValid = function(isValid){
       	    	    alert(isValid)
       	    }
       }

                                CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest
 6
             var ValidationServiceProxy = function(callbackObject){
           this.validateEmail = function(emailaddress){
               validateEmailRequest = getXmlHttpRequestObject();
               if (validateEmailRequest.readyState == 4 || validateEmailRequest.readyState == 0) {
       	             var params = "method=validateEmail&emailaddress=" + emailaddress.value;
                   validateEmailRequest.open("GET", 'validationService.php?' + params, true);
                   validateEmailRequest.onreadystatechange = validateEmailResponse;
                   validateEmailRequest.send(null);
               }
           }
           validateEmailResponse = function(){
               if (validateEmailRequest.readyState == 4) {
                  var isEmailValid = eval("(" + validateEmailRequest.responseText + ")");
                  var isValid = (isEmailValid[0].emailaddressCount == 0)
                  callbackObject.setValid(isValid)
               }
           }
           getXmlHttpRequestObject = function(){
               if (window.XMLHttpRequest) {
                   return new XMLHttpRequest();
               }
               else {
                   if (window.ActiveXObject) {
                       return new ActiveXObject("Microsoft.XMLHTTP");
                   }
               }
           }
       }
                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest - Callback
 7

        function callback() {
          if (xmlHttp.readyState == 4) {
             if (xmlHttp.status == 200) {
             //do something interesting here
             }
          }
        }



                           CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest
 8

          You aren't allowed to make XMLHttpRequests to any
           server except the server where your web page
           came from.




                           CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest: Application Proxy
 9



       AJAX Enabled Web App.                            Webserver: Application Proxy

                                                                       Server
                                                                       Resource
          XHR
                           function callback()
                           {
           2               }
                                                        Webserver
                                                        in other domain


          event                                                       WebService




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest: Application Proxy
 9



       AJAX Enabled Web App.                            Webserver: Application Proxy

                                                                       Server
                                                                       Resource
          XHR
                           function callback()
                           {
           2               }
                                                        Webserver
                                                        in other domain

                            1
          event                                                       WebService




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest: Application Proxy
 9



       AJAX Enabled Web App.                            Webserver: Application Proxy
                                                   3
                                                                       Server
                                                                       Resource
          XHR
                           function callback()
                           {
           2               }
                                                        Webserver
                                                        in other domain

                            1
          event                                                       WebService




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest: Application Proxy
 9



       AJAX Enabled Web App.                            Webserver: Application Proxy
                                                   3
                                                                       Server
                                                                       Resource
          XHR
                           function callback()
                           {                                                      4
           2               }
                                                        Webserver
                                                        in other domain

                            1
          event                                                       WebService




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest: Application Proxy
 9



       AJAX Enabled Web App.                            Webserver: Application Proxy
                                                   3
                                                                       Server
                                                                       Resource
          XHR
                                                   5
                           function callback()
                           {                                                      4
           2               }
                                                        Webserver
                                                        in other domain

                            1
          event                                                       WebService




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XMLHttpRequest: Application Proxy
 9



       AJAX Enabled Web App.                            Webserver: Application Proxy
                                                   3
                                                                       Server
                                                                       Resource
          XHR
                                                   5
                           function callback()
                           {                                                      4
           2               }            6
                                                        Webserver
                                                        in other domain

                            1
          event                                                       WebService




                                          CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
On Demand JavaScript
10



       Web App.                          Webserver in other domain
                                                        Server
                                                        Resource
          <script>
          </script>
                                                        returns js


          2




          event                                        WebService


       http://ajaxpatterns.org/On-Demand_Javascript
                           CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
On Demand JavaScript
10



       Web App.                              Webserver in other domain
                                                            Server
                                                            Resource
          <script>
          </script>
                                                            returns js


          2



                           1
          event                                            WebService


       http://ajaxpatterns.org/On-Demand_Javascript
                               CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
On Demand JavaScript
10



       Web App.                              Webserver in other domain
                                        3                   Server
                                                            Resource
          <script>
          </script>
                                                            returns js


          2



                           1
          event                                            WebService


       http://ajaxpatterns.org/On-Demand_Javascript
                               CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
On Demand JavaScript
10



       Web App.                              Webserver in other domain
                                        3                   Server
                                                            Resource
          <script>
          </script>
                                                            returns js


          2                                                              4




                           1
          event                                            WebService


       http://ajaxpatterns.org/On-Demand_Javascript
                               CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
On Demand JavaScript
10



       Web App.                              Webserver in other domain
                                        3                   Server
                                                            Resource
          <script>
          </script>
                                                            returns js
                                        5

          2                                                              4




                           1
          event                                            WebService


       http://ajaxpatterns.org/On-Demand_Javascript
                               CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
On Demand JavaScript
10



       Web App.                                  Webserver in other domain
                                 <script id="external_script"
                                              3
                                 type="text/JavaScript"> Server
                               </script>                      Resource
          <script>
          </script>            <script>                       returns js
                                              5
                                 document.getElementById('external_script').src
                                   = 'http://cross.domain.com/other.js'; 4
          2                    </script>



                           1
          event                                                   WebService


       http://ajaxpatterns.org/On-Demand_Javascript
                                      CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
XML AND JSON
Thursday, March 18, 2010
XML vs JSON
12


       XML                                 JSON

       <employee>                          var employee = {
       <firstName>John</firstName>             "firstName" : John
       <lastName>Doe</lastName>                , "lastName" : Doe
       <empNr>123</empNr>                      , "empNr" : 123
       <title>Accountant</title>               , "title" : "Accountant"
       </employee>                         }




                             CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
JSON Is Not...
13

          JSON is not a document format.
          JSON is not a markup language.
          JSON is not a general serialization format.
             No recursive/recurring structures.
             No invisible structures.
             No functions.




                              CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
Object
14
        {
                "name":              "Jack B. Nimble",
                "at large": true,
                "grade":             "A",
                "format": {
                           "type":          "rect",
                           "width":         1920,
                           "height":        1080,
                           "interlace": false,
                           "framerate": 24
                }
        }                              CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
JSON in Ajax
15

          XMLHttpRequest
             Obtain  responseText
             Parse the responseText


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

                 responseData    =
                      responseText.parseJSON();



                                    CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
Security
16

          Is it safe to use eval with XMLHttpRequest?
          The JSON data comes from the same server that
           vended the page. An eval of the data is no less
           secure than the original html.
          If in doubt, use string.parseJSON instead of eval.




                           CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
JSON Is Not XML
17

          objects                           element
          arrays                            attribute
          strings                           attribute string
          numbers                           content
          booleans                          <![CDATA[ ]]>
          null                              entities
                                             declarations
                                             schema
                                             stylesheets
                                             comments
                                             version
                                             namespace



                           CRIA WT - Rody Middelkoop

Thursday, March 18, 2010
Server-side JSON
18

            <?php
       	    $emailaddresses = getDataFromDataSource(
       "SELECT COUNT(*) AS emailaddressCount from adresboek where emailaddress = '" .
       $_REQUEST["emailaddress"] ."'");
       	    $emailaddressesForJSON = array();
       	    while( $row = mysql_fetch_array($emailaddresses))
       	    {
       	    	    array_push($emailaddressesForJSON, $row);
       	    }
       	    $jsonText = json_encode( $emailaddressesForJSON );
       	    echo $jsonText;

       function getDataFromDataSource($query)
       {
       	    mysql_connect("127.0.0.1", "root", "root")
              or die("Connection Failure to Database");
       	    mysql_select_db("criademo") or die ("Database criademo not found.");
       	    $result = mysql_query($query);
       	    return $result;
       }
       ?>

                                  CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
Who is responsible for the right
19
       format?
       Web App.                          Webserver


                                                       WebService
          Client




          event




                           CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
Who is responsible for the right
19
       format?
       Web App.                              Webserver


                                                           WebService
          Client




                           1
          event




                               CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
Who is responsible for the right
19
       format?
       Web App.                              Webserver
                                        2
                                                           WebService
          Client




                           1
          event




                               CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
Who is responsible for the right
19
       format?
       Web App.                              Webserver
                                        2
                                                           WebService
          Client
                                        3




                           1
          event




                               CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
Who is responsible for the right
19
       format?
       Web App.                              Webserver
                                        2
                                                           WebService
          Client
                                        3



                                               1.SOAP: returns XML
                                               2.REST: let the client pick a
                           1                   format like XML, JSON, HTML
          event




                               CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010
Resources and a big thank you
20

          JSON the x in AJAX, www.json.org/json.pdf
       




                           CRIA-WT - Rody Middelkoop

Thursday, March 18, 2010

More Related Content

What's hot

Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBTobias Trelle
 
Transforming Mobile Push Notifications with Big Data
Transforming Mobile Push Notifications with Big DataTransforming Mobile Push Notifications with Big Data
Transforming Mobile Push Notifications with Big Dataplumbee
 
Reusing existing data_layer_to_persist_multi_f
Reusing existing data_layer_to_persist_multi_fReusing existing data_layer_to_persist_multi_f
Reusing existing data_layer_to_persist_multi_fbol.com
 
RMLL 2013 - Synchronize OpenLDAP and Active Directory with LSC
RMLL 2013 - Synchronize OpenLDAP and Active Directory with LSCRMLL 2013 - Synchronize OpenLDAP and Active Directory with LSC
RMLL 2013 - Synchronize OpenLDAP and Active Directory with LSCClément OUDOT
 
最新のデータベース技術の方向性で思うこと
最新のデータベース技術の方向性で思うこと最新のデータベース技術の方向性で思うこと
最新のデータベース技術の方向性で思うことMasayoshi Hagiwara
 
Synchronize OpenLDAP with Active Directory with LSC project
Synchronize OpenLDAP with Active Directory with LSC projectSynchronize OpenLDAP with Active Directory with LSC project
Synchronize OpenLDAP with Active Directory with LSC projectClément OUDOT
 
Mapserver vs Geoserver
Mapserver vs GeoserverMapserver vs Geoserver
Mapserver vs Geoservernovum.limitis
 

What's hot (8)

Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
Transforming Mobile Push Notifications with Big Data
Transforming Mobile Push Notifications with Big DataTransforming Mobile Push Notifications with Big Data
Transforming Mobile Push Notifications with Big Data
 
Reusing existing data_layer_to_persist_multi_f
Reusing existing data_layer_to_persist_multi_fReusing existing data_layer_to_persist_multi_f
Reusing existing data_layer_to_persist_multi_f
 
RMLL 2013 - Synchronize OpenLDAP and Active Directory with LSC
RMLL 2013 - Synchronize OpenLDAP and Active Directory with LSCRMLL 2013 - Synchronize OpenLDAP and Active Directory with LSC
RMLL 2013 - Synchronize OpenLDAP and Active Directory with LSC
 
最新のデータベース技術の方向性で思うこと
最新のデータベース技術の方向性で思うこと最新のデータベース技術の方向性で思うこと
最新のデータベース技術の方向性で思うこと
 
Synchronize OpenLDAP with Active Directory with LSC project
Synchronize OpenLDAP with Active Directory with LSC projectSynchronize OpenLDAP with Active Directory with LSC project
Synchronize OpenLDAP with Active Directory with LSC project
 
Introduction to Mongodb
Introduction to MongodbIntroduction to Mongodb
Introduction to Mongodb
 
Mapserver vs Geoserver
Mapserver vs GeoserverMapserver vs Geoserver
Mapserver vs Geoserver
 

Viewers also liked

PHPNW14 - Getting Started With AWS
PHPNW14 - Getting Started With AWSPHPNW14 - Getting Started With AWS
PHPNW14 - Getting Started With AWSbenwaine
 
Turning Marketing Words into a Branded People Experience
Turning Marketing Words into a Branded People ExperienceTurning Marketing Words into a Branded People Experience
Turning Marketing Words into a Branded People ExperienceBridge Training and Events
 
Web Security Introduction Webserver hacking refers to ...
Web Security Introduction Webserver hacking refers to ...Web Security Introduction Webserver hacking refers to ...
Web Security Introduction Webserver hacking refers to ...webhostingguy
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.jsguileen
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applicationsSatish b
 
Server side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHPServer side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHPMarc Gear
 
Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.Herman Peeren
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat
WebSphere App Server vs JBoss vs WebLogic vs TomcatWebSphere App Server vs JBoss vs WebLogic vs Tomcat
WebSphere App Server vs JBoss vs WebLogic vs TomcatWASdev Community
 
Client Vs. Server Rendering
Client Vs. Server RenderingClient Vs. Server Rendering
Client Vs. Server RenderingDavid Amend
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)Roman Kharkovski
 
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMPHow To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMPMatt Dunlap
 

Viewers also liked (17)

Nodejs
NodejsNodejs
Nodejs
 
PHPNW14 - Getting Started With AWS
PHPNW14 - Getting Started With AWSPHPNW14 - Getting Started With AWS
PHPNW14 - Getting Started With AWS
 
Turning Marketing Words into a Branded People Experience
Turning Marketing Words into a Branded People ExperienceTurning Marketing Words into a Branded People Experience
Turning Marketing Words into a Branded People Experience
 
Web Security Introduction Webserver hacking refers to ...
Web Security Introduction Webserver hacking refers to ...Web Security Introduction Webserver hacking refers to ...
Web Security Introduction Webserver hacking refers to ...
 
Basic Website 101
Basic Website 101Basic Website 101
Basic Website 101
 
Summer training seminar
Summer training seminarSummer training seminar
Summer training seminar
 
Web Fendamentals
Web FendamentalsWeb Fendamentals
Web Fendamentals
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.js
 
Joomla REST API
Joomla REST APIJoomla REST API
Joomla REST API
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
 
Server side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHPServer side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHP
 
Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.
 
SmokeTests
SmokeTestsSmokeTests
SmokeTests
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat
WebSphere App Server vs JBoss vs WebLogic vs TomcatWebSphere App Server vs JBoss vs WebLogic vs Tomcat
WebSphere App Server vs JBoss vs WebLogic vs Tomcat
 
Client Vs. Server Rendering
Client Vs. Server RenderingClient Vs. Server Rendering
Client Vs. Server Rendering
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
 
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMPHow To Deploy A Cloud Based Webserver in 5 minutes - LAMP
How To Deploy A Cloud Based Webserver in 5 minutes - LAMP
 

Similar to AJAX Applications and XMLHttpRequest

Similar to AJAX Applications and XMLHttpRequest (20)

Ajax
AjaxAjax
Ajax
 
Unit-5.pptx
Unit-5.pptxUnit-5.pptx
Unit-5.pptx
 
Ajax
AjaxAjax
Ajax
 
Ajax Lecture Notes
Ajax Lecture NotesAjax Lecture Notes
Ajax Lecture Notes
 
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
 
Suga ajax training
Suga ajax trainingSuga ajax training
Suga ajax training
 
AJAX
AJAXAJAX
AJAX
 
RicoAjaxEngine
RicoAjaxEngineRicoAjaxEngine
RicoAjaxEngine
 
RicoAjaxEngine
RicoAjaxEngineRicoAjaxEngine
RicoAjaxEngine
 
Ajax tutorial by bally chohan
Ajax tutorial by bally chohanAjax tutorial by bally chohan
Ajax tutorial by bally chohan
 
Rails MVC Architecture
Rails MVC ArchitectureRails MVC Architecture
Rails MVC Architecture
 
ASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep DiveASP.NET Core 3.0 Deep Dive
ASP.NET Core 3.0 Deep Dive
 
Java EE and Glassfish
Java EE and GlassfishJava EE and Glassfish
Java EE and Glassfish
 
Ajax
AjaxAjax
Ajax
 
What's new in the July 2017 Update for Dynamics 365 - Developer features
What's new in the July 2017 Update for Dynamics 365 - Developer featuresWhat's new in the July 2017 Update for Dynamics 365 - Developer features
What's new in the July 2017 Update for Dynamics 365 - Developer features
 
Slide 3 Fast Data processing with kafka, rfx and redis
Slide 3 Fast Data processing with kafka, rfx and redisSlide 3 Fast Data processing with kafka, rfx and redis
Slide 3 Fast Data processing with kafka, rfx and redis
 
Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009
Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009
Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009
 

More from Rody Middelkoop

Integration and Unit Testing in Java using Test Doubles like mocks and stubs
Integration and Unit Testing in Java using Test Doubles like mocks and stubsIntegration and Unit Testing in Java using Test Doubles like mocks and stubs
Integration and Unit Testing in Java using Test Doubles like mocks and stubsRody Middelkoop
 
An agile mindset in education
An agile mindset in education An agile mindset in education
An agile mindset in education Rody Middelkoop
 
Eduscrum presentatie Scrum event 2016: Scrum als onderwijsaanpak
Eduscrum presentatie Scrum event 2016: Scrum als onderwijsaanpakEduscrum presentatie Scrum event 2016: Scrum als onderwijsaanpak
Eduscrum presentatie Scrum event 2016: Scrum als onderwijsaanpakRody Middelkoop
 
Pecha Kucha eduScrum Agile Education
Pecha Kucha eduScrum Agile EducationPecha Kucha eduScrum Agile Education
Pecha Kucha eduScrum Agile EducationRody Middelkoop
 
Unit Testing Android Applications
Unit Testing Android ApplicationsUnit Testing Android Applications
Unit Testing Android ApplicationsRody Middelkoop
 
Softwarekwaliteit in een ontwikkelstraat
Softwarekwaliteit in een ontwikkelstraatSoftwarekwaliteit in een ontwikkelstraat
Softwarekwaliteit in een ontwikkelstraatRody Middelkoop
 
JavaScript on the server - Node.js
JavaScript on the server - Node.jsJavaScript on the server - Node.js
JavaScript on the server - Node.jsRody Middelkoop
 
DDOA = Software Craftmanship
DDOA = Software CraftmanshipDDOA = Software Craftmanship
DDOA = Software CraftmanshipRody Middelkoop
 
Back to the Future: Onderwijs van 1991 tot 2031
Back to the Future: Onderwijs van 1991 tot 2031Back to the Future: Onderwijs van 1991 tot 2031
Back to the Future: Onderwijs van 1991 tot 2031Rody Middelkoop
 
Scrum implemented in an educational context
Scrum implemented in an educational contextScrum implemented in an educational context
Scrum implemented in an educational contextRody Middelkoop
 
Pragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use CasesPragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use CasesRody Middelkoop
 
Scrum in informaticaonderwijs
Scrum in informaticaonderwijsScrum in informaticaonderwijs
Scrum in informaticaonderwijsRody Middelkoop
 
Saas: Software AND Service
Saas: Software AND ServiceSaas: Software AND Service
Saas: Software AND ServiceRody Middelkoop
 
Service Analysis And Design
Service Analysis And DesignService Analysis And Design
Service Analysis And DesignRody Middelkoop
 
Contract First Modeling Services Using Uml
Contract First Modeling Services Using UmlContract First Modeling Services Using Uml
Contract First Modeling Services Using UmlRody Middelkoop
 

More from Rody Middelkoop (19)

Integration and Unit Testing in Java using Test Doubles like mocks and stubs
Integration and Unit Testing in Java using Test Doubles like mocks and stubsIntegration and Unit Testing in Java using Test Doubles like mocks and stubs
Integration and Unit Testing in Java using Test Doubles like mocks and stubs
 
An agile mindset in education
An agile mindset in education An agile mindset in education
An agile mindset in education
 
Themalunch scrum
Themalunch scrumThemalunch scrum
Themalunch scrum
 
Eduscrum presentatie Scrum event 2016: Scrum als onderwijsaanpak
Eduscrum presentatie Scrum event 2016: Scrum als onderwijsaanpakEduscrum presentatie Scrum event 2016: Scrum als onderwijsaanpak
Eduscrum presentatie Scrum event 2016: Scrum als onderwijsaanpak
 
Pecha Kucha eduScrum Agile Education
Pecha Kucha eduScrum Agile EducationPecha Kucha eduScrum Agile Education
Pecha Kucha eduScrum Agile Education
 
Unit Testing Android Applications
Unit Testing Android ApplicationsUnit Testing Android Applications
Unit Testing Android Applications
 
Software Process Models
Software Process ModelsSoftware Process Models
Software Process Models
 
Softwarekwaliteit in een ontwikkelstraat
Softwarekwaliteit in een ontwikkelstraatSoftwarekwaliteit in een ontwikkelstraat
Softwarekwaliteit in een ontwikkelstraat
 
JavaScript on the server - Node.js
JavaScript on the server - Node.jsJavaScript on the server - Node.js
JavaScript on the server - Node.js
 
DDOA = Software Craftmanship
DDOA = Software CraftmanshipDDOA = Software Craftmanship
DDOA = Software Craftmanship
 
Back to the Future: Onderwijs van 1991 tot 2031
Back to the Future: Onderwijs van 1991 tot 2031Back to the Future: Onderwijs van 1991 tot 2031
Back to the Future: Onderwijs van 1991 tot 2031
 
Scrum implemented in an educational context
Scrum implemented in an educational contextScrum implemented in an educational context
Scrum implemented in an educational context
 
OO JavaScript
OO JavaScriptOO JavaScript
OO JavaScript
 
Pragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use CasesPragmatic Model Driven Development In Java Using Smart Use Cases
Pragmatic Model Driven Development In Java Using Smart Use Cases
 
Scrum in informaticaonderwijs
Scrum in informaticaonderwijsScrum in informaticaonderwijs
Scrum in informaticaonderwijs
 
Saas: Software AND Service
Saas: Software AND ServiceSaas: Software AND Service
Saas: Software AND Service
 
Service Analysis And Design
Service Analysis And DesignService Analysis And Design
Service Analysis And Design
 
ORM JPA
ORM JPAORM JPA
ORM JPA
 
Contract First Modeling Services Using Uml
Contract First Modeling Services Using UmlContract First Modeling Services Using Uml
Contract First Modeling Services Using Uml
 

Recently uploaded

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
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
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
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
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

AJAX Applications and XMLHttpRequest

  • 1. AJAX CRIA Webtechnology Thursday, March 18, 2010
  • 2. Some applications of AJAX 2  Validation  Dynamic listboxes  Autorefresh  Excessive tooltips  Calling webservices CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 3. AJAX 3  Asynchronous Javascript And XML  No DOM Standard, equals implementation in several browsers through the XMLHttpRequest CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 4. XMLHttpRequest 4 AJAX Enabled Web App. Webserver Server Resource XHR function callback() { 2 } Databaseserver event DB CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 5. XMLHttpRequest 4 AJAX Enabled Web App. Webserver Server Resource XHR function callback() { 2 } Databaseserver 1 DB event CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 6. XMLHttpRequest 4 AJAX Enabled Web App. Webserver 3 Server Resource XHR function callback() { 2 } Databaseserver 1 DB event CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 7. XMLHttpRequest 4 AJAX Enabled Web App. Webserver 3 Server Resource XHR function callback() { 4 2 } Databaseserver 1 DB event CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 8. XMLHttpRequest 4 AJAX Enabled Web App. Webserver 3 Server Resource XHR 5 function callback() { 4 2 } Databaseserver 1 DB event CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 9. XMLHttpRequest 4 AJAX Enabled Web App. Webserver 3 Server Resource XHR 5 function callback() { 4 2 } 6 Databaseserver 1 DB event CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 10. XMLHttpRequest 5 HTML: <div id="emailSection"> <input id="email" type="text" onblur="new ValidationServiceRequestor().validateEmail();"/> <label>Emailadres</label> </div> JAVASCRIPT: var ValidationServiceRequestor = function(){ this.validateEmail = function(){ var emailaddress = document.getElementById("email"); var serviceProxy = new ValidationServiceProxy(this); serviceProxy.validateEmail(emailaddress); } this.setValid = function(isValid){ alert(isValid) } } CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 11. XMLHttpRequest 6 var ValidationServiceProxy = function(callbackObject){ this.validateEmail = function(emailaddress){ validateEmailRequest = getXmlHttpRequestObject(); if (validateEmailRequest.readyState == 4 || validateEmailRequest.readyState == 0) { var params = "method=validateEmail&emailaddress=" + emailaddress.value; validateEmailRequest.open("GET", 'validationService.php?' + params, true); validateEmailRequest.onreadystatechange = validateEmailResponse; validateEmailRequest.send(null); } } validateEmailResponse = function(){ if (validateEmailRequest.readyState == 4) { var isEmailValid = eval("(" + validateEmailRequest.responseText + ")"); var isValid = (isEmailValid[0].emailaddressCount == 0) callbackObject.setValid(isValid) } } getXmlHttpRequestObject = function(){ if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else { if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } } } } CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 12. XMLHttpRequest - Callback 7 function callback() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { //do something interesting here } } } CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 13. XMLHttpRequest 8  You aren't allowed to make XMLHttpRequests to any server except the server where your web page came from. CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 14. XMLHttpRequest: Application Proxy 9 AJAX Enabled Web App. Webserver: Application Proxy Server Resource XHR function callback() { 2 } Webserver in other domain event WebService CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 15. XMLHttpRequest: Application Proxy 9 AJAX Enabled Web App. Webserver: Application Proxy Server Resource XHR function callback() { 2 } Webserver in other domain 1 event WebService CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 16. XMLHttpRequest: Application Proxy 9 AJAX Enabled Web App. Webserver: Application Proxy 3 Server Resource XHR function callback() { 2 } Webserver in other domain 1 event WebService CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 17. XMLHttpRequest: Application Proxy 9 AJAX Enabled Web App. Webserver: Application Proxy 3 Server Resource XHR function callback() { 4 2 } Webserver in other domain 1 event WebService CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 18. XMLHttpRequest: Application Proxy 9 AJAX Enabled Web App. Webserver: Application Proxy 3 Server Resource XHR 5 function callback() { 4 2 } Webserver in other domain 1 event WebService CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 19. XMLHttpRequest: Application Proxy 9 AJAX Enabled Web App. Webserver: Application Proxy 3 Server Resource XHR 5 function callback() { 4 2 } 6 Webserver in other domain 1 event WebService CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 20. On Demand JavaScript 10 Web App. Webserver in other domain Server Resource <script> </script> returns js 2 event WebService http://ajaxpatterns.org/On-Demand_Javascript CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 21. On Demand JavaScript 10 Web App. Webserver in other domain Server Resource <script> </script> returns js 2 1 event WebService http://ajaxpatterns.org/On-Demand_Javascript CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 22. On Demand JavaScript 10 Web App. Webserver in other domain 3 Server Resource <script> </script> returns js 2 1 event WebService http://ajaxpatterns.org/On-Demand_Javascript CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 23. On Demand JavaScript 10 Web App. Webserver in other domain 3 Server Resource <script> </script> returns js 2 4 1 event WebService http://ajaxpatterns.org/On-Demand_Javascript CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 24. On Demand JavaScript 10 Web App. Webserver in other domain 3 Server Resource <script> </script> returns js 5 2 4 1 event WebService http://ajaxpatterns.org/On-Demand_Javascript CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 25. On Demand JavaScript 10 Web App. Webserver in other domain <script id="external_script" 3 type="text/JavaScript"> Server </script> Resource <script> </script> <script> returns js 5 document.getElementById('external_script').src = 'http://cross.domain.com/other.js'; 4 2 </script> 1 event WebService http://ajaxpatterns.org/On-Demand_Javascript CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 26. XML AND JSON Thursday, March 18, 2010
  • 27. XML vs JSON 12 XML JSON <employee> var employee = { <firstName>John</firstName> "firstName" : John <lastName>Doe</lastName> , "lastName" : Doe <empNr>123</empNr> , "empNr" : 123 <title>Accountant</title> , "title" : "Accountant" </employee> } CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 28. JSON Is Not... 13  JSON is not a document format.  JSON is not a markup language.  JSON is not a general serialization format.  No recursive/recurring structures.  No invisible structures.  No functions. CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 29. Object 14 { "name": "Jack B. Nimble", "at large": true, "grade": "A", "format": { "type": "rect", "width": 1920, "height": 1080, "interlace": false, "framerate": 24 } } CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 30. JSON in Ajax 15  XMLHttpRequest  Obtain responseText  Parse the responseText  responseData = eval(  '(' + responseText + ')');  responseData =  responseText.parseJSON(); CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 31. Security 16  Is it safe to use eval with XMLHttpRequest?  The JSON data comes from the same server that vended the page. An eval of the data is no less secure than the original html.  If in doubt, use string.parseJSON instead of eval. CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 32. JSON Is Not XML 17  objects  element  arrays  attribute  strings  attribute string  numbers  content  booleans  <![CDATA[ ]]>  null  entities  declarations  schema  stylesheets  comments  version  namespace CRIA WT - Rody Middelkoop Thursday, March 18, 2010
  • 33. Server-side JSON 18 <?php $emailaddresses = getDataFromDataSource( "SELECT COUNT(*) AS emailaddressCount from adresboek where emailaddress = '" . $_REQUEST["emailaddress"] ."'"); $emailaddressesForJSON = array(); while( $row = mysql_fetch_array($emailaddresses)) { array_push($emailaddressesForJSON, $row); } $jsonText = json_encode( $emailaddressesForJSON ); echo $jsonText; function getDataFromDataSource($query) { mysql_connect("127.0.0.1", "root", "root") or die("Connection Failure to Database"); mysql_select_db("criademo") or die ("Database criademo not found."); $result = mysql_query($query); return $result; } ?> CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 34. Who is responsible for the right 19 format? Web App. Webserver WebService Client event CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 35. Who is responsible for the right 19 format? Web App. Webserver WebService Client 1 event CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 36. Who is responsible for the right 19 format? Web App. Webserver 2 WebService Client 1 event CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 37. Who is responsible for the right 19 format? Web App. Webserver 2 WebService Client 3 1 event CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 38. Who is responsible for the right 19 format? Web App. Webserver 2 WebService Client 3 1.SOAP: returns XML 2.REST: let the client pick a 1 format like XML, JSON, HTML event CRIA-WT - Rody Middelkoop Thursday, March 18, 2010
  • 39. Resources and a big thank you 20  JSON the x in AJAX, www.json.org/json.pdf  CRIA-WT - Rody Middelkoop Thursday, March 18, 2010