SlideShare a Scribd company logo
1 of 33
LESSON FOUR
    jQuery intro
Fast Review
Functions = “First Class Objects”
Anonymous Functions

     function() {
      // code goes here
      }
Arrays


data structure for ordered values
   var team = [‘ben’,‘jeff’,‘kam’];
   team[0] // => ‘ben’
Objects



collections of “key/value” properties
  var person = {};
  person.name = ‘will’;    // Write
  var name = person.name; // Read
Document Object Model
Review Homework
Enter, jQuery
What is jQuery

Framework for using Javascript to interact with
the browser
•   Simple DOM API: manipulate HTML / CSS on the page

•   Simple AJAX API: send and receive data from the server

•   Simple Event API: do stuff when the user does stuff

•   Thats it!
What is a Framework?

                    A library of utility functions

Small                  Medium                   Large
•   Underscore.js       •   jQuery UI       •    YUI (Yahoo UI)
•   jQuery              •   MooTools        •    GWT (Google web toolkit)
•   Prototype.js        •   Dojo            •    EXT JS (commercial)



      there are LOTS of them for web development
Why use jQuery
•   The DOM API is _nasty_!

•   Cross browser

•   Fast - Faster than raw DOM manipulation! *magic*

•   Lightweight (31kb)

•   Stable and trusted

•   Required for many other frameworks

•   EVERYBODY uses it
Include jQuery
<script src="/js/jquery.js"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/
jquery.min.js"></script>



                         Try it out!
jQuery Syntax
  or…how to follow the $

$(document).ready(function(){
  // Your code here
});




    DOM Manipulation
   $("a").addClass("test");
using jQuery
Selecting Elements
                      Using CSS!


$("#foo")     // the [element] at id “foo”


$(".bloop")   // the [elements] with class “bloop”


$("a.buzz")   // the [links] with class ‘buzz’



$(".bloop:first")      // specialty! The first bloop!


=>   :hidden, :visible, :last, :checked, :empty,       :odd...
Important Methods
.show() / .hide() / .toggle()
   $(".swap_text").toggle();


.addClass(".active")
.removeClass(".active")


.css(key, value)
   $("#my_box").css(‘backgroundColor’,   ‘red’);
   $("#my_box").css({

            ‘backgroundColor’ : ‘red’,
            ‘color’ : ‘#030’
   });
Important Methods

.animate(properties, duration, callback)

   $(‘#my_box’).animate({
            ‘backgroundColor’ : ‘red’,
            ‘marginTop‘         : ‘20px’,
            ‘color‘             : ‘#030’
   }, 3000, justFinished);   // execute the animation for 3 seconds
                             // and when done, call: justFinished();
Important Methods

.html() / .val() / .attr(‘attribute’)

   $(‘#my_title’).html(); // returns the innerHTML

   $(‘#my_title’).html(“New Title!”); // sets the innerHTML



   $(‘input#email’).val(“please enter your email address...”);



   $(‘img’).attr(“src”, “placekitten.com/30/30”);



                             as before: these methods can get or set...
Methods Can “Chain”




$("#my_box").addClass(‘inactive’).removeClass(‘active’).hide();
jQuery Events

$(document).ready()     // the DOM is loaded
window.load()           // all elements (including images)
                           have loaded


.change()
.submit()
.focus()
.click
.scroll()
.hover()
.keypress()                                ...And so many more!
Events w/o jQuery
                      no browser consistency




EX:


.addEventListener("click", function({}) );   // Firefox


.attachEvent("onclick", function({}) );      // Internet Explorer
jQuery Insertion




.append()
.after()
.insertAfter()
.before
.insertBefore()
.clone()
Client Side
   Requests
[XHR and AJAX]
XMLHttpRequest




Allows you to make a web request via client side javascript
Invented by Microsoft for Internet Explorer, then ported to other
browsers

   var request = new XMLHttpRequest(); // Create new request object
   request.open(“GET”, “path/file.ext”, false); // “open” the request
   request.send(null); // Make the request
   var text = request.responseText; // Check the response text
BUZZZZWORD




“XHR”
•   XMLHttpRequest

•   Misnomer => Not limited to XML data

•   By default, synchronous
AJAX




By default, XHR proceeds synchronously
In other words, your code will hang until the request is complete
What if you want your code to keep executing?
   => Use AJAX
BUZZZZWORD



“AJAX”
•   “Asynchronous Javascript and XML”

•   XHR done asynchronously

•   Provide a callback to execute when the request is complete

•   Changed the face of web development => page reloads no longer
    required to add new content to a page
AJAX via DOM



var request = new XMLHttpRequest(); // Create new request object
request.open(“GET”, “path/file.ext”, true); // ‘True’ => AJAX

request.send(null); // Make the request
var text = request.responseText; // Will be null this time!
request.onreadystatechange = function() {
 if (request.readyState == 4) {
     // Request is done. Can check responseText
 }
AJAX via DOM



var request = new XMLHttpRequest(); // Create new request object
request.open(“GET”, “path/file.ext”, true); // ‘True’ => AJAX


          CONFUSING this time!
request.send(null); // Make the request
var text = request.responseText; // Will be null
request.onreadystatechange = function() {
 if (request.readyState == 4) {
     // Request is done. Can check responseText
 }
AJAX via jQuery



    $.ajax({
  url: "test.html",
  success: function(return_text){
    $("#results").append(return_text);
 }
});




                          more next week...
QUESTIONS?
contact will_and_bay@hackyale.com

More Related Content

What's hot

Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
Angel Ruiz
 
Jquery Best Practices
Jquery Best PracticesJquery Best Practices
Jquery Best Practices
brinsknaps
 
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperVenturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Jon Kruger
 

What's hot (20)

jQuery Introduction
jQuery IntroductionjQuery Introduction
jQuery Introduction
 
jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009jQuery Loves Developers - Oredev 2009
jQuery Loves Developers - Oredev 2009
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
jQuery
jQueryjQuery
jQuery
 
jQuery
jQueryjQuery
jQuery
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
 
jQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and BlingjQuery: Nuts, Bolts and Bling
jQuery: Nuts, Bolts and Bling
 
Unobtrusive javascript with jQuery
Unobtrusive javascript with jQueryUnobtrusive javascript with jQuery
Unobtrusive javascript with jQuery
 
jQuery in 15 minutes
jQuery in 15 minutesjQuery in 15 minutes
jQuery in 15 minutes
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Jquery Best Practices
Jquery Best PracticesJquery Best Practices
Jquery Best Practices
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 
jQuery Presentation
jQuery PresentationjQuery Presentation
jQuery Presentation
 
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby DeveloperVenturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
Venturing Into The Wild: A .NET Developer's Experience As A Ruby Developer
 
D3.js and SVG
D3.js and SVGD3.js and SVG
D3.js and SVG
 
Testable, Object-Oriented JavaScript
Testable, Object-Oriented JavaScriptTestable, Object-Oriented JavaScript
Testable, Object-Oriented JavaScript
 
SharePoint and jQuery Essentials
SharePoint and jQuery EssentialsSharePoint and jQuery Essentials
SharePoint and jQuery Essentials
 
Don't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQueryDon't Worry jQuery is very Easy:Learning Tips For jQuery
Don't Worry jQuery is very Easy:Learning Tips For jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 

Viewers also liked (6)

Metodología de Investigación "Comunicative Daile Life Stories"
Metodología de Investigación "Comunicative Daile Life Stories"Metodología de Investigación "Comunicative Daile Life Stories"
Metodología de Investigación "Comunicative Daile Life Stories"
 
Application 1785686
Application 1785686Application 1785686
Application 1785686
 
2007 bpc conference
2007 bpc conference2007 bpc conference
2007 bpc conference
 
Lives of the Great War: Building First World War life stories across archives...
Lives of the Great War: Building First World War life stories across archives...Lives of the Great War: Building First World War life stories across archives...
Lives of the Great War: Building First World War life stories across archives...
 
Alexis Willey
Alexis Willey Alexis Willey
Alexis Willey
 
State of the LexBlog Address 2016 - Slides from LexBlog's Webinar
State of the LexBlog Address 2016 - Slides from LexBlog's WebinarState of the LexBlog Address 2016 - Slides from LexBlog's Webinar
State of the LexBlog Address 2016 - Slides from LexBlog's Webinar
 

Similar to Week 4 - jQuery + Ajax

Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
Luke Summerfield
 
Javascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & TricksJavascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & Tricks
Hjörtur Hilmarsson
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
Sven Haiges
 

Similar to Week 4 - jQuery + Ajax (20)

A Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NETA Rich Web experience with jQuery, Ajax and .NET
A Rich Web experience with jQuery, Ajax and .NET
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
 
jQuery
jQueryjQuery
jQuery
 
A Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NETA Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NET
 
Jquery fundamentals
Jquery fundamentalsJquery fundamentals
Jquery fundamentals
 
JavaScript JQUERY AJAX
JavaScript JQUERY AJAXJavaScript JQUERY AJAX
JavaScript JQUERY AJAX
 
J query training
J query trainingJ query training
J query training
 
jQuery for web development
jQuery for web developmentjQuery for web development
jQuery for web development
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
 
Unit3.pptx
Unit3.pptxUnit3.pptx
Unit3.pptx
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
jQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journeyjQuery Data Manipulate API - A source code dissecting journey
jQuery Data Manipulate API - A source code dissecting journey
 
Javascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & TricksJavascript MVC & Backbone Tips & Tricks
Javascript MVC & Backbone Tips & Tricks
 
Introducing jQuery
Introducing jQueryIntroducing jQuery
Introducing jQuery
 
22 j query1
22 j query122 j query1
22 j query1
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
JQuery UI
JQuery UIJQuery UI
JQuery UI
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Week 4 - jQuery + Ajax

  • 1.
  • 2. LESSON FOUR jQuery intro
  • 4. Functions = “First Class Objects”
  • 5. Anonymous Functions function() { // code goes here }
  • 6. Arrays data structure for ordered values var team = [‘ben’,‘jeff’,‘kam’]; team[0] // => ‘ben’
  • 7. Objects collections of “key/value” properties var person = {}; person.name = ‘will’; // Write var name = person.name; // Read
  • 11. What is jQuery Framework for using Javascript to interact with the browser • Simple DOM API: manipulate HTML / CSS on the page • Simple AJAX API: send and receive data from the server • Simple Event API: do stuff when the user does stuff • Thats it!
  • 12. What is a Framework? A library of utility functions Small Medium Large • Underscore.js • jQuery UI • YUI (Yahoo UI) • jQuery • MooTools • GWT (Google web toolkit) • Prototype.js • Dojo • EXT JS (commercial) there are LOTS of them for web development
  • 13. Why use jQuery • The DOM API is _nasty_! • Cross browser • Fast - Faster than raw DOM manipulation! *magic* • Lightweight (31kb) • Stable and trusted • Required for many other frameworks • EVERYBODY uses it
  • 14. Include jQuery <script src="/js/jquery.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/ jquery.min.js"></script> Try it out!
  • 15. jQuery Syntax or…how to follow the $ $(document).ready(function(){ // Your code here }); DOM Manipulation $("a").addClass("test");
  • 17. Selecting Elements Using CSS! $("#foo") // the [element] at id “foo” $(".bloop") // the [elements] with class “bloop” $("a.buzz") // the [links] with class ‘buzz’ $(".bloop:first") // specialty! The first bloop! => :hidden, :visible, :last, :checked, :empty, :odd...
  • 18. Important Methods .show() / .hide() / .toggle() $(".swap_text").toggle(); .addClass(".active") .removeClass(".active") .css(key, value) $("#my_box").css(‘backgroundColor’, ‘red’); $("#my_box").css({ ‘backgroundColor’ : ‘red’, ‘color’ : ‘#030’ });
  • 19. Important Methods .animate(properties, duration, callback) $(‘#my_box’).animate({ ‘backgroundColor’ : ‘red’, ‘marginTop‘ : ‘20px’, ‘color‘ : ‘#030’ }, 3000, justFinished); // execute the animation for 3 seconds // and when done, call: justFinished();
  • 20. Important Methods .html() / .val() / .attr(‘attribute’) $(‘#my_title’).html(); // returns the innerHTML $(‘#my_title’).html(“New Title!”); // sets the innerHTML $(‘input#email’).val(“please enter your email address...”); $(‘img’).attr(“src”, “placekitten.com/30/30”); as before: these methods can get or set...
  • 22. jQuery Events $(document).ready() // the DOM is loaded window.load() // all elements (including images) have loaded .change() .submit() .focus() .click .scroll() .hover() .keypress() ...And so many more!
  • 23. Events w/o jQuery no browser consistency EX: .addEventListener("click", function({}) ); // Firefox .attachEvent("onclick", function({}) ); // Internet Explorer
  • 25. Client Side Requests [XHR and AJAX]
  • 26. XMLHttpRequest Allows you to make a web request via client side javascript Invented by Microsoft for Internet Explorer, then ported to other browsers var request = new XMLHttpRequest(); // Create new request object request.open(“GET”, “path/file.ext”, false); // “open” the request request.send(null); // Make the request var text = request.responseText; // Check the response text
  • 27. BUZZZZWORD “XHR” • XMLHttpRequest • Misnomer => Not limited to XML data • By default, synchronous
  • 28. AJAX By default, XHR proceeds synchronously In other words, your code will hang until the request is complete What if you want your code to keep executing? => Use AJAX
  • 29. BUZZZZWORD “AJAX” • “Asynchronous Javascript and XML” • XHR done asynchronously • Provide a callback to execute when the request is complete • Changed the face of web development => page reloads no longer required to add new content to a page
  • 30. AJAX via DOM var request = new XMLHttpRequest(); // Create new request object request.open(“GET”, “path/file.ext”, true); // ‘True’ => AJAX request.send(null); // Make the request var text = request.responseText; // Will be null this time! request.onreadystatechange = function() { if (request.readyState == 4) { // Request is done. Can check responseText }
  • 31. AJAX via DOM var request = new XMLHttpRequest(); // Create new request object request.open(“GET”, “path/file.ext”, true); // ‘True’ => AJAX CONFUSING this time! request.send(null); // Make the request var text = request.responseText; // Will be null request.onreadystatechange = function() { if (request.readyState == 4) { // Request is done. Can check responseText }
  • 32. AJAX via jQuery $.ajax({   url: "test.html",   success: function(return_text){     $("#results").append(return_text);  } }); more next week...

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n