EECS1012. Net-centric Introduction to Computing. Lecture "Putting It All Together" and a little bit of AJAX
|
|
- May Sherman
- 6 years ago
- Views:
Transcription
1 EECS 1012 Net-centric Introduction to Computing Lecture "Putting It All Together" and a little bit of AJAX Acknowledgements The contents of these slides may be modified and redistributed, please give appropriate credit. (Creative Commons) Michael S. Brown, M.S. Brown, EECS York University 1
2 2 HTML, CSS, PHP, and JavaScript
3 HTML 3 HTML Provides the markup language to generate the structure and content of a webpage.
4 CSS 4 CSS Provides the markup language to modify the appearance of the webpage.
5 PHP (server-side scripting) 5 PHP Allowed dynamic generation of HTML content. This could be used with HTML forms to generate content based on data sent by the user.
6 JavaScript (client-side scripting) 6 JavaScript Allowed our pages to be interactive, without having to contact the server. Provided the ability to add "behavior" to the webpage.
7 The sweet spot 7 JavaScript Putting this all together, we create the best of our web experiences. PHP HTML CSS
8 8 Putting it all together
9 Three examples 9 1. Keeping track of # of visitors (PHP only) 2. Inspirational quotes 1. without AJAX 2. with AJAX 3. Online "to do" list
10 10 Example 1: # of visitors
11 Tracking # of visitors to your page 11 Revisit our initial webpage aboutme.html
12 HTML page redirected to PHP 12 We'd prefer the user to type in an HTML page instead of a PHP page We can "redirect" the initial HTML page to our PHP page
13 HTML Redirect 13 We can have our initial HTML page redirected to a PHP version. aboutme.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> : Lab 1 </title> <meta http-equiv="refresh" content="0; URL=' </head> <body> </body> </html> Re-directs to aboutme.php after waiting 0 seconds
14 HTML Redirect 14 <meta http-equiv="refresh" content="0; url=' Note that the content attribute has double quotes around the following: wait_time_in_seconds; url='url to be redirected to'
15 Back to our example 15 Revisit our initial webpage aboutme.html Our PHP code will modify this part of the webpage only.
16 PHP code added to HTML page 16 HTML code <?php /* First check if file exists, if doesn't exist save "1" to it */ if (file_exists("visitorcount.txt") == false) { file_put_contents("visitorcount.txt", "1"); /* retrieve content, add one to it, write it back*/ $count = file_get_contents("visitorcount.txt"); $count = $count + 1; file_put_contents("visitorcount.txt", $count); /* write back to file */ /* print the visitor's count info */ print "<p style=\"text-align: center;\"> ". /* concat this */ "You are visitor $count </p> \n"; /* w/ next line */?> </body> </html>
17 What is going on? 17 Client (browser) Server visitorcount.txt File Client requests HTML page. 1) HTML page redirected to PHP 2) PHP opens the "visitorcount.txt". Adds one to the value, writes it back to the file. Prints the value from the file, writes it to the HTML page.
18 18 Example #2 - Quotes Revisited
19 Remember this PHP code? 19 Every time you visited the page, it returned a different quote!
20 How this PHP code worked 20 PHP code <?php $quotes = file("quotes.txt"); $i = array_rand($quotes); $output = htmlspecialchars($quotes[$i]); print "<p> <quote> $output </quote> </p> \n";?> "quotes.txt" Quote1... Quote2... Quote3 Quote. Opens a "quotes.txt" file as an array. Selects random an array index. Converts string using htmlspecialchars(..). Prints the string to a <p> tag.
21 Quotes using PHP 21 Client (browser) Quote Access PHP file Random Quote appears. We page is refreshed in browser Server File Open's quote.txt generates a new HTML sends it If you want another quote, you have to access the PHP code again.
22 Problem? 22 To change the quote, we need to call the PHP file again (i.e. refresh the webpage) This will update the entire webpage Can we somehow pass the data in the "quotes.txt" to our JavaScript file?
23 We want an interactive quote via JS 23. Add quotes here. These change on their own every 3 seconds.
24 PHP creates the quote in the HTML 24 <div id="box"> <?php print "<p>"; print '<button id="next">next</button><button id="stop">stop</button>'; print " <quote id=\"quote_footer\"> $output </quote> </p> ";?> </div>
25 25 Javascript code var timerid = null; var quoteid = 0; window.onload = function () { $("next").onclick = nextquote; $("stop").onclick = stoptimer; timerid = setinterval(nextquote, 3000); Set up "onclick" events. Set timer to change to next Quote. Be nice to have an array of all the quotes on the client side (i.e. inside JavaScript) function nextquote() { $("quote_footer").innerhtml = quotes[quoteid]; quoteid++; if (quoteid >= quotes.length) quoteid=0; function stoptimer() { clearinterval(timerid); nextquote changes to new quote in array quotes[ ]; stoptimer() clears the intervaltimer.
26 Where do we get the "quotes[]"? 26 function nextquote() { $("quote_footer").innerhtml = quotes[quoteid]; quoteid++; if (quoteid >= quotes.length) quoteid=0; function stoptimer() { clearinterval(timerid); Variable we use should contain all the quotes from the "quotes.txt" file. But this file is on the server! "quotes.txt" Quote1... Quote2... Quote3 Quote. Ideally, we'd like: quotes = [ "Quote1", "Quote2", "Quote3",., "QuoteLast" ];
27 Use PHP to modify our JS file! 27 <?php $quotes = file("quotes.txt"); /* open file */ $write_to_java = "var quotes=[ "; /* generate JS code */ $count = count($quotes); /* an array named "quotes" */ for($i=0; $i < $count-1; $i++) /* loop through quotes */ { $output = htmlspecialchars(trim($quotes[$i])); /* convert */ $write_to_java.= "\"$output\","; /* write to array string */ $output = htmlspecialchars(trim($quotes[$count-1])); /* last Quote */ $write_to_java.= "\"$output\" ];"; /* print with ]; end */ /* open JS "template" file read whole file in as a string */ $JSFile = file_get_contents("quotes_template.js"); /* write the variable part to the string using concatenate. operator */ $JSFile.= $write_to_java; file_put_contents("quotes.js", $JSFile); /* save the JS file */?>
28 What just happened? 28 aboutme2.php quotes.txt Client (browser) Access PHP file HTML output + updated JS file Server File quotes_template.js JS File (1) There is only one call to the PHP file. It modifies the JS file as necessary. (3) All necessary data is now in JS file. We can update quote using JS. Client (browser) Quote (2) PHP file modified the JS code. copy quotes_template.js's content + add the generated var quotes = ["Quote1", "Quote2", "Quote3", ]; JS File with array from Quote
29 JS code generated by our PHP program 29 var quotes=[ ""If you want to achieve greatness stop asking for permission." -- Anonymous",""Things work out best for those who make the best of how things work out." --John Wooden",""To live a creative life, we must lose our fear of being wrong." --Anonymous",""If you are not willing to risk the usual you will have to settle for the ordinary." --Jim Rohn",""Trust because you are willing to accept the risk, not because it's safe or certain." --Anonymous",""Take up one idea. Make that one idea your life--think of it, dream of it, live on that idea. Let the brain, muscles, nerves, every part of your body, be full of that idea, and just leave every other idea alone. This is the way to success." --Swami Vivekananda",""All our dreams can come true if we have the courage to pursue them." --Walt Disney",""Good things come to people who wait, but better things come to those who go out and get them." -- Anonymous",""If you do what you always did, you will get what you always got." --Anonymous",""Success is walking from failure to failure with no loss of enthusiasm." --Winston Churchill",""Just when the caterpillar thought the world was ending, he turned into a butterfly." --Proverb",""Successful entrepreneurs are givers and not takers of positive energy." --Anonymous",""Whenever you see a successful person you only see the public glories, never the private sacrifices to reach them." --Vaibhav Shah" ];
30 Code generation 30 This style is known as "code generation" That is, the PHP program generated new code This is generally considered bad style, but is fairly common This style of code generation is working within the synchronized mode of web server access
31 Synchronous web access 31 In this case "event" is submitting a form, or loading a page. synchronous: user must wait while new pages load the typical communication pattern used in web pages (click, wait, refresh)
32 32 AJAX
33 Asynchronous access 33 Result is sent to JavaScript. JS can be used to modify the page. The key here is "partial page". JS is used to update the webpage.
34 Asynchronous JavaScript And XML 34 AJAX (Asychronous JS and XML) XML = extensive markup language AJAX This is a method to encode up data This is also a slightly incorrect term, because AJAX does not require XML as we will see. Allows JS to make a request to the server using XMLHttpRequest When request returns, an event hanlder is called with the result JS can update the webpage based on the result
35 How it works 35
36 AJAX - for our quotes example 36 var quote = null; var timerid; window.onload = function () { $("next").onclick = updatequote; $("stop").onclick = stoptimer; timerid = setinterval(getquote, 3000); function updatequote() { $("quote_footer").innerhtml = quote; function stoptimer() { clearinterval(timerid); function getquote() { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readystate == 4) { if (this.status == 200) { quote = this.responsetext; updatequote(); ; xmlhttp.open("get", "quotes.php", true); xmlhttp.send(); AJAX code
37 Examining the AJAX Request 37 function getquote() { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readystate == 4) { if (this.status == 200) { quote = this.responsetext; updatequote(); ; xmlhttp.open("get", "quotes.php", true); xmlhttp.send(); Create an "AJAX request" Define an anonymous function to handle the result when it comes back. When the event results, check status to make sure it worked (see next slide). Set variable "quote" to the response from the AJAX call. Call the "updatequote()" function. This opens the connection to the browser. We send a "GET" post (like forms). We call the PHP file "quotes.php". send() sends the request established in "open". "true" means this is an asynchronous call.
38 readystate and status 38 Property onreadystatechange Description Stores a function (or the name of a function) to be called automatically each time the readystate property changes. This is the event handler that processes the result after the rquest has been sent. readystate Holds the status of the XMLHttpRequest. Changes from 0 to 1-4: 0: request not initialized 1: server connection established 2: request received 3: processing request 4: request finished and response is ready status 200: "OK" (everything was fine) 404: Page not found (something went wrong) See previous slide, we check to make sure the readystate=4 and status=200.
39 Example PHP quotes.php 39 <?php $quotes = file("quotes.txt"); /* open file as an array */ $i = array_rand($quotes); /* select random index into array */ $response = htmlspecialchars($quotes[$i]); /*convert to HTML */ /*special char encoding */ print $response; /* output response this will returned to the */ /* XMLHttpRequest(); */?> This is the PHP code called by our XMLHttpRequest(); Note how it doesn't have any HTML output only prints out the string directly.
40 What is happening? 40 Client (browser) Access PHP file HTML output to browser aboutme2.php Server quotes.txt File JS sends AJAX request JS updates webpage when request returns Client (browser) Quote AJAX access PHP file AJAX return to JS (Does not require webpage to be refreshed) quotes.php Server quotes.txt File
41 41 Example #3 Online Todo
42 Online 'ToDo List' 42 todo.html, todo.css, todo.js List items are stored on the server. When the webpage loads, we retrieve the items. If we delete or add, we send the info to the server.
43 Todo HTML and Todo PHP 43 todo.html Client (browser) Basic HTML page with JS code Server todo.php todo.txt Client JS code makes (browser) three types of AJAX calls: (1) todo.php?getlist=true (2) todo.pp?delete=item (3) todo.php?add=item Server File PHP application responses depending on type of request
44 HTML code 44 "myinput" "addbutton" "myul" <body> "messagespan" <div id="mydiv"> <h2>my Online ToDo List</h2> <p> New item: <input type="text" id="myinput"> <button id="addbutton">add</button> </p> <ul id="myul"> </ul> <p> <span id="messagespan">hi</span> </p> </div> </body>
45 Multi-purpose PHP code 45 Our JS code will make the following three calls to the PHP program: 1. todo.php?getlist=true 2. todo.php?add=item_to_add 3. todo.php?delete=item_to_delete
46 Multi-purpose PHP code 46 <?php /* Get the list */ if (isset($_get["getlist"])) { $content = file("todo.txt"); for($i=0; $i < count($content); $i++) { print trim($content[$i]). "\n"; /* add to list */ if (isset($_get["add"])) { $item_to_add = "{$_GET["add"]\n"; if "getlist" is defined. Opens the file. prints out the content separated by a \n If "add" is defined. Appends the item to the "todo.txt" file. file_put_contents("todo.txt", $item_to_add, FILE_APPEND); print "Item <$item_to_add> added to server"; todo.txt item1 item2 item3 item4
47 Multi-purpose PHP code -if "delete" is defined. /* 47 delete item */ if (isset($_get["delete"])) { $item_to_delete = $_GET["delete"]; $content = file("todo.txt"); file_put_contents("todo.txt", ""); for($i=0; $i < count($content); $i++) { /* if item found - don't write it to file */ if (trim($content[$i])!= $item_to_delete) { file_put_contents("todo.txt", $content[$i], FILE_APPEND); print "Item deleted on server\n"; todo.txt?> Message returned item1 to AJAX call. item2 item3 item4 -get "item to delete" from client. -open "todo" file. -delete the contents. - loop through each item in the file. - if the name of the item is the same as the one to be delete, don't write it back to the file. don't copy item that is to be delete todo.txt item1 item2 item4
48 JS code (several pages) 48 /* onload - set addbutton's function */ window.onload = function() { $("addbutton").onclick = additem; getlistfromserver(); /* calls server to get List */
49 JS code 49 function getlistfromserver() /* will call todo.php?getlist=true */ { var xmlhttp = new XMLHttpRequest(); /* make AJAX request */ xmlhttp.onreadystatechange = function() { if (this.readystate == 4) { if (this.status == 200) { var items = this.responsetext; /* items is a string with each item */ additemsfromserver(items); /* separated by a \n */ postmessage("items loaded from server"); /* posts a message */.. xmlhttp.open("get", "todo.php?getlist=true", true); xmlhttp.send(); Perform AJAX call to get the contents of the list. PHP will return the items as one big string separated by "\n".
50 JS code 50 function additemsfromserver(items) { /* items is a string passed with each time in the list separated by a \n */ /* items.split is equivalent to PHP explode("\n", $items) */ var itemarray = items.split("\n"); /* splits string into array */ for(var i=0; i < itemarray.length; i++) /* for each item in the array */ { if (itemarray[i]!= "") { /* make sure items isn't empty */ var newli = document.createelement("li"); /* create new item */ newli.onclick = clickli; /* set its click event */ newli.innerhtml = itemarray[i]; /* add content */ $("myul").appendchild(newli); /* append to myul list */ Break the string into an array of items. Add each item as an <li> element to the DOM tree.
51 JS code 51 function postmessage(msg) /* msg is a string to be posted */ { $("messagespan").innerhtml = msg; /* Set a timeout to clear this message after 5 */ /* use an anonymous function to clear message after 3 seconds */ settimeout(function () { var messagespan = document.getelementbyid("messagespan"); $("messagespan").innerhtml = "";, 3000); Simple message function that display something in the "messagespan".. and then creates a timer event to delete the contents after 3 seconds.
52 JS code 52 function clickli() { /* will call todo.php?delete=item_to_delete */ var result = confirm("do you want to delete this item?"); if (result == true) { var item = this.innerhtml; /* item_to_delete */ $("myul").removechild(this); /* remove from HTML using DOM */ var xmlhttp = new XMLHttpRequest(); /* send PHP a message to delete */ xmlhttp.onreadystatechange = function() { If an "li" is clicked, we use a pop-up if (this.readystate == 4) { window to ask if we want to delete if (this.status == 200) { the item. postmessage(this.responsetext); If so, do an AJAX call to delete the item. xmlhttp.open("get", "todo.php?delete=" + item, true); xmlhttp.send();
53 JS code 53 function additem() { /* will call todo.php?add=item_to_delete */ { if ($(myinput).value!= "") { /* if value is empty do nothing */ var newli = document.createelement("li"); /* create item */ newli.innerhtml = $("myinput").value; /* add content */ newli.onclick = clickli; /* add clickevent */ $("myul").appendchild(newli); /* append new element to DOM tree */ var xmlhttp = new XMLHttpRequest(); /* Create AJAX call */ xmlhttp.onreadystatechange = function() { if (this.readystate == 4) { if (this.status == 200) { If "addbutton" is clicked. postmessage(this.responsetext); /* post Add message a new */ item to the list, call PHP code to add the item. xmlhttp.open("get", "todo.php?add=" + $("myinput").value, true); xmlhttp.send();
54 Recap 54 Three examples to help see how we can put everything together Example #2 shows how to do "code generation" where we use PHP to modify our JS code Example #2 and #3 show examples using AJAX Most of the social network platforms use this style of asynchronous communication between server and client NOTE: AJAX will not be on the final exam or labtest
AJAX. Ajax: Asynchronous JavaScript and XML *
AJAX Ajax: Asynchronous JavaScript and XML * AJAX is a developer's dream, because you can: Read data from a web server - after the page has loaded Update a web page without reloading the page Send data
More informationAJAX: The Basics CISC 282 March 25, 2014
AJAX: The Basics CISC 282 March 25, 2014 Synchronous Communication User and server take turns waiting User requests pages while browsing Waits for server to respond Waits for the page to load in the browser
More informationAJAX: Introduction CISC 282 November 27, 2018
AJAX: Introduction CISC 282 November 27, 2018 Synchronous Communication User and server take turns waiting User requests pages while browsing Waits for server to respond Waits for the page to load in the
More informationAJAX: Asynchronous Event Handling Sunnie Chung
AJAX: Asynchronous Event Handling Sunnie Chung http://adaptivepath.org/ideas/ajax-new-approach-web-applications/ http://stackoverflow.com/questions/598436/does-an-asynchronous-call-always-create-call-a-new-thread
More informationAJAX. Lecture 26. Robb T. Koether. Fri, Mar 21, Hampden-Sydney College. Robb T. Koether (Hampden-Sydney College) AJAX Fri, Mar 21, / 16
AJAX Lecture 26 Robb T. Koether Hampden-Sydney College Fri, Mar 21, 2014 Robb T. Koether (Hampden-Sydney College) AJAX Fri, Mar 21, 2014 1 / 16 1 AJAX 2 Http Requests 3 Request States 4 Handling the Response
More informationAJAX: The Basics CISC 282 November 22, 2017
AJAX: The Basics CISC 282 November 22, 2017 Synchronous Communication User and server take turns waiting User requests pages while browsing Waits for server to respond Waits for the page to load in the
More informationTIME SCHEDULE MODULE TOPICS PERIODS. HTML Document Object Model (DOM) and javascript Object Notation (JSON)
COURSE TITLE : ADVANCED WEB DESIGN COURSE CODE : 5262 COURSE CATEGORY : A PERIODS/WEEK : 4 PERIODS/SEMESTER : 52 CREDITS : 4 TIME SCHEDULE MODULE TOPICS PERIODS 1 HTML Document Object Model (DOM) and javascript
More information2/6/2012. Rich Internet Applications. What is Ajax? Defining AJAX. Asynchronous JavaScript and XML Term coined in 2005 by Jesse James Garrett
What is Ajax? Asynchronous JavaScript and XML Term coined in 2005 by Jesse James Garrett http://www.adaptivepath.com/ideas/essays/archives /000385.php Ajax isn t really new, and isn t a single technology
More informationXMLHttpRequest. CS144: Web Applications
XMLHttpRequest http://oak.cs.ucla.edu/cs144/examples/google-suggest.html Q: What is going on behind the scene? What events does it monitor? What does it do when
More informationEECS1012. Net-centric Introduction to Computing. More PHP: Arrays and Files
EECS 1012 EECS1012 Net-centric Introduction to Computing More PHP: Arrays and Files Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and
More informationEECS1012. Net-centric Introduction to Computing. Lecture JavaScript Events
EECS 1012 Net-centric Introduction to Computing Lecture JavaScript Events Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst.
More informationWeb Application Security
Web Application Security Rajendra Kachhwaha rajendra1983@gmail.com September 23, 2015 Lecture 13: 1/ 18 Outline Introduction to AJAX: 1 What is AJAX 2 Why & When use AJAX 3 What is an AJAX Web Application
More informationWeb Security, Summer Term 2012
IIG University of Freiburg Web Security, Summer Term 2012 Cross Site Scripting - XSS Dr. E. Benoist Sommer Semester Web Security, Summer Term 2012 5 Cross Site Scripting 1 Table of Contents Presentation:
More informationWeb Security, Summer Term 2012
Table of Contents IIG University of Freiburg Web Security, Summer Term 2012 Cross Site Scripting - XSS Dr. E. Benoist Sommer Semester Presentation: Inject Javascript in a Page Javascript for manipulating
More informationwemx WebService V1.0
wemx WebService 2 wemx WebService WEMX WEBSERVICE... 1 1. WEB SERVICE INTRODUCTION... 6 1.1. SYSTEM PAGE... 6 1.2. USER PAGE... 7 1.3. WEB SERVICE API... 8 2. SYSTEM PAGE PROVIDED BY THE WEB SERVICE...
More informationthis is a cat CS50 Quiz 1 Review
CS50 Quiz 1 Review this is a cat CS50 Quiz 1 Review JavaScript CS50 Quiz 1 Review first, recall from zamyla Remember, PHP is run server-side. The HTML output of this PHP code is sent to the user. Server
More informationCSE 115. Introduction to Computer Science I
CSE 115 Introduction to Computer Science I Road map Review JSON Chat App - Part 1 AJAX Chat App - Part 2 Front End JavaScript first Web Page my content
More informationSession 11. Ajax. Reading & Reference
Session 11 Ajax Reference XMLHttpRequest object Reading & Reference en.wikipedia.org/wiki/xmlhttprequest Specification developer.mozilla.org/en-us/docs/web/api/xmlhttprequest JavaScript (6th Edition) by
More informationjquery and AJAX
jquery and AJAX http://www.flickr.com/photos/pmarkham/3165964414/ Dynamic HTML (DHTML) Manipulating the web page's structure is essential for creating a highly responsive UI Two main approaches Manipulate
More informationClient Side JavaScript and AJAX
Client Side JavaScript and AJAX Client side javascript is JavaScript that runs in the browsers of people using your site. So far all the JavaScript code we've written runs on our node.js server. This is
More informationIntroduction to AJAX Bringing Interactivity & Intuitiveness Into Web Applications. By : Bhanwar Gupta SD-Team-Member Jsoft Solutions
Introduction to AJAX Bringing Interactivity & Intuitiveness Into Web Applications By : Bhanwar Gupta SD-Team-Member Jsoft Solutions Applications today You have two basic choices: Desktop applications and
More informationUniversity of Washington, CSE 190 M Homework Assignment 9: Remember the Cow (To-Do List)
University of Washington, CSE 190 M Homework Assignment 9: Remember the Cow (To-Do List) In this assignment you will write a small yet complete "Web 2.0" application that includes user login sessions,
More informationEECS1012. Net-centric Introduction to Computing. Lecture JavaScript and Forms
EECS 1012 Net-centric Introduction to Computing Lecture JavaScript and Forms Acknowledgements The contents of these slides may be modified and redistributed, please give appropriate credit. M.S. Brown,
More informationLecture 8. ReactJS 1 / 24
Lecture 8 ReactJS 1 / 24 Agenda 1. JSX 2. React 3. Redux 2 / 24 JSX 3 / 24 JavaScript + HTML = JSX JSX is a language extension that allows you to write HTML directly into your JavaScript files. Behind
More informationAjax- XMLHttpResponse. Returns a value such as ArrayBuffer, Blob, Document, JavaScript object, or a DOMString, based on the value of
Ajax- XMLHttpResponse XMLHttpResponse - A Read only field Returns a value such as ArrayBuffer, Blob, Document, JavaScript object, or a DOMString, based on the value of XMLHttpRequest.responseType. This
More informationControlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser.
Controlled Assessment Task Question 1 - Describe how this HTML code produces the form displayed in the browser. The form s code is displayed in the tags; this creates the object which is the visible
More informationAJAX. Introduction. AJAX: Asynchronous JavaScript and XML
AJAX 1 2 Introduction AJAX: Asynchronous JavaScript and XML Popular in 2005 by Google Create interactive web applications Exchange small amounts of data with the server behind the scenes No need to reload
More informationCSC 337. JavaScript Object Notation (JSON) Rick Mercer
CSC 337 JavaScript Object Notation (JSON) Rick Mercer Why JSON over XML? JSON was built to know JS JSON JavaScript Object Notation Data-interchange format Lightweight Replacement for XML It's just a string
More informationEECS1012. Net-centric Introduction to Computing. Lecture JavaScript DOM
EECS 1012 Net-centric Introduction to Computing Lecture JavaScript DOM Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst. Slides
More informationCSE 115. Introduction to Computer Science I
CSE 115 Introduction to Computer Science I Midterm Midterm will be returned no later than Monday. We may make midterm pickup available before then. Stay tuned. Midterm results Module 1 Module 2 Overall
More informationCSCU9B2 Practical 1: Introduction to HTML 5
CSCU9B2 Practical 1: Introduction to HTML 5 Aim: To learn the basics of creating web pages with HTML5. Please register your practical attendance: Go to the GROUPS\CSCU9B2 folder in your Computer folder
More informationAjax. Ronald J. Glotzbach
Ajax Ronald J. Glotzbach What is AJAX? Asynchronous JavaScript and XML Ajax is not a technology Ajax mixes well known programming techniques in an uncommon way Enables web builders to create more appealing
More informationA.A. 2008/09. What is Ajax?
Internet t Software Technologies AJAX IMCNE A.A. 2008/09 Gabriele Cecchetti What is Ajax? AJAX stands for Asynchronous JavaScript And XML. AJAX is a type of programming made popular in 2005 by Google (with
More informationModule 5: Javascript, Cookies COM 420
Module 5: Javascript, Cookies COM 420 What is the real Internet Lab 1 Review Many Nesting Problems How to check your code Why is nesting Important Recap how grades work in the class Re-Submitting and updating
More informationAjax. David Matuszek's presentation,
Ajax David Matuszek's presentation, http://www.cis.upenn.edu/~matuszek/cit597-2007/index.html Oct 20, 2008 The hype Ajax (sometimes capitalized as AJAX) stands for Asynchronous JavaScript And XML Ajax
More informationController/server communication
Controller/server communication Mendel Rosenblum Controller's role in Model, View, Controller Controller's job to fetch model for the view May have other server communication needs as well (e.g. authentication
More informationAjax Ajax Ajax = Asynchronous JavaScript and XML Using a set of methods built in to JavaScript to transfer data between the browser and a server in the background Reduces the amount of data that must be
More informationThe Structure of the Web. Jim and Matthew
The Structure of the Web Jim and Matthew Workshop Structure 1. 2. 3. 4. 5. 6. 7. What is a browser? HTML CSS Javascript LUNCH Clients and Servers (creating a live website) Build your Own Website Workshop
More informationASSIGNMENT #3: CLIENT-SIDE INTERACTIVITY WITH JAVASCRIPT AND AJAX
ASSIGNMENT #3: CLIENT-SIDE INTERACTIVITY WITH JAVASCRIPT AND AJAX Due October 20, 2010 (in lecture) Reflection Ideation Exercise Bonus Challenge Digital Order from Chaos (15 Points) In Everything Is Miscellaneous,
More informationAJAX ASYNCHRONOUS JAVASCRIPT AND XML. Laura Farinetti - DAUIN
AJAX ASYNCHRONOUS JAVASCRIPT AND XML Laura Farinetti - DAUIN Rich-client asynchronous transactions In 2005, Jesse James Garrett wrote an online article titled Ajax: A New Approach to Web Applications (www.adaptivepath.com/ideas/essays/archives/000
More informationPart of this connection identifies how the response can / should be provided to the client code via the use of a callback routine.
What is AJAX? In one sense, AJAX is simply an acronym for Asynchronous JavaScript And XML In another, it is a protocol for sending requests from a client (web page) to a server, and how the information
More informationTHE HITCHHIKERS GUIDE TO. Harper Maddox CTO, EdgeTheory 30 September 2014
THE HITCHHIKERS GUIDE TO! Harper Maddox CTO, EdgeTheory 30 September 2014 DON T PANIC ENJOYMENT OF ANGULAR Services, Modules promises, directives Angular RULEZ I m doing it wrong @#$% Taken from Alicia
More informationAjax Ajax Ajax = Asynchronous JavaScript and XML Using a set of methods built in to JavaScript to transfer data between the browser and a server in the background Reduces the amount of data that must be
More informationWeb development using PHP & MySQL with HTML5, CSS, JavaScript
Web development using PHP & MySQL with HTML5, CSS, JavaScript Static Webpage Development Introduction to web Browser Website Webpage Content of webpage Static vs dynamic webpage Technologies to create
More informationAnnouncements. 1. Class webpage: Have you been reading the announcements? Lecture slides and coding examples will be posted
Announcements 1. Class webpage: Have you been reading the announcements? Lecture slides and coding examples will be posted 2. Campus is closed on Monday. 3. Install Komodo Edit on your computer this weekend.
More informationClient-side Development using HTML, Javascript and CSS
Lab 1 Client-side Development using HTML, Javascript and CSS Authors: Sahand Sdjadee Alexander Kazen Gustav Bylund Per Jonsson Tobias Jansson Spring 2015 TDDD97 Web Programming http://www.ida.liu.se/~tddd97/
More informationCSE 115. Introduction to Computer Science I
CSE 115 Introduction to Computer Science I Client Sends requests to server at "/" first Web Page my content
More informationExecutive Summary. Performance Report for: https://edwardtbabinski.us/blogger/social/index. The web should be fast. How does this affect me?
The web should be fast. Executive Summary Performance Report for: https://edwardtbabinski.us/blogger/social/index Report generated: Test Server Region: Using: Analysis options: Tue,, 2017, 4:21 AM -0400
More informationAsynchronous JavaScript + XML (Ajax)
Asynchronous JavaScript + XML (Ajax) CSE 190 M (Web Programming), Spring 2008 University of Washington References: w3schools, Wikipedia Except where otherwise noted, the contents of this presentation are
More informationAJAX. Lab. de Bases de Dados e Aplicações Web MIEIC, FEUP 2010/11. Sérgio Nunes
AJAX Lab. de Bases de Dados e Aplicações Web MIEIC, FEUP 2010/11 Sérgio Nunes Server calls from web pages using JavaScript call HTTP data Motivation The traditional request-response cycle in web applications
More informationPIC 40A. Review for the Final. Copyright 2011 Jukka Virtanen UCLA 1 06/05/15
PIC 40A Review for the Final 06/05/15 Copyright 2011 Jukka Virtanen UCLA 1 Overview Final is on: Monday, June 08, 2015 11:30 AM - 2:30 PM Geology 4645 Double check on myucla.edu. 06/05/15 Copyright Jukka
More informationAnnouncements. 1. Class webpage: Have you been reading the announcements? Lecture slides and coding examples will be posted
Announcements 1. Class webpage: Have you been reading the announcements? Lecture slides and coding examples will be posted 2. Install Komodo Edit on your computer right away. 3. Bring laptops to next class
More informationCS Final Exam Review Suggestions - Spring 2018
CS 328 - Final Exam Review Suggestions p. 1 CS 328 - Final Exam Review Suggestions - Spring 2018 last modified: 2018-05-03 Based on suggestions from Prof. Deb Pires from UCLA: Because of the research-supported
More informationquiz 1 details wed nov 17, 1pm see handout for locations covers weeks 0 through 10, emphasis on 7 onward closed book bring a , 2-sided cheat she
quiz 1 details wed nov 17, 1pm see handout for locations covers weeks 0 through 10, emphasis on 7 onward closed book bring a 8.5 11, 2-sided cheat sheet 75 minutes 15% of final grade resources old quizzes
More informationContents. Demos folder: Demos\14-Ajax. 1. Overview of Ajax. 2. Using Ajax directly. 3. jquery and Ajax. 4. Consuming RESTful services
Ajax Contents 1. Overview of Ajax 2. Using Ajax directly 3. jquery and Ajax 4. Consuming RESTful services Demos folder: Demos\14-Ajax 2 1. Overview of Ajax What is Ajax? Traditional Web applications Ajax
More informationdjango-xross Documentation
django-xross Documentation Release 0.6.0 Igor idle sign Starikov Jan 14, 2018 Contents 1 Description 3 2 Requirements 5 3 Table of Contents 7 3.1 Quickstart................................................
More informationAbstract. 1. Introduction. 2. AJAX overview
Asynchronous JavaScript Technology and XML (AJAX) Chrisina Draganova Department of Computing, Communication Technology and Mathematics London Metropolitan University 100 Minories, London EC3 1JY c.draganova@londonmet.ac.uk
More informationComp 426 Midterm Fall 2013
Comp 426 Midterm Fall 2013 I have not given nor received any unauthorized assistance in the course of completing this examination. Name: PID: This is a closed book exam. This page left intentionally blank.
More informationUniversity of Washington, CSE 154 Homework Assignment 8: Baby Names
University of Washington, CSE 154 Homework Assignment 8: Baby Names This assignment is about using Ajax to fetch data in text, HTML, XML, and JSON formats. Every 10 years, the Social Security Administration
More informationExecutive Summary. Performance Report for: The web should be fast. Top 4 Priority Issues
The web should be fast. Executive Summary Performance Report for: https://www.wpspeedupoptimisation.com/ Report generated: Test Server Region: Using: Tue,, 2018, 12:04 PM -0800 London, UK Chrome (Desktop)
More informationKey features. Nothing to do with java It is the Client-side scripting language Designed to add interactivity to HTML pages
Javascript Key features Nothing to do with java It is the Client-side scripting language Designed to add interactivity to HTML pages (DHTML): Event-driven programming model AJAX Great example: Google Maps
More informationManual Html A Href Onclick Submit Form
Manual Html A Href Onclick Submit Form JS HTML DOM. DOM Intro DOM Methods HTML form validation can be done by a JavaScript. If a form field _input type="submit" value="submit" /form_. As shown in a previous
More informationController/server communication
Controller/server communication Mendel Rosenblum Controller's role in Model, View, Controller Controller's job to fetch model for the view May have other server communication needs as well (e.g. authentication
More informationAngularJS AN INTRODUCTION. Introduction to the AngularJS framework
AngularJS AN INTRODUCTION Introduction to the AngularJS framework AngularJS Javascript framework for writing frontend web apps DOM manipulation, input validation, server communication, URL management,
More informationInteractive Web Application
Interactive Web Application This lesson builds on previous lessons With this lesson we will be picking up right where we left off from our Node.js Hosting lesson. The presentation can be found at http://rockymountaincoding.org.
More informationUsing AJAX to Easily Integrate Rich Media Elements
505 Using AJAX to Easily Integrate Rich Media Elements James Monroe Course Developer, WWW.eLearningGuild.com The Problem: How to string together several rich media elements (images, Flash movies, video,
More informationClient vs Server Scripting
Client vs Server Scripting PHP is a server side scripting method. Why might server side scripting not be a good idea? What is a solution? We could try having the user download scripts that run on their
More informationJquery.ajax Call Returns Status Code Of 200 But Fires Jquery Error
Jquery.ajax Call Returns Status Code Of 200 But Fires Jquery Error The request returns http 200 OK, but the xhr status is 0, error. jquery Ajax Request to get JSON data fires error event to make an ajax
More informationJquery Manually Set Checkbox Checked Or Not
Jquery Manually Set Checkbox Checked Or Not Working Second Time jquery code to set checkbox element to checked not working. Apr 09 I forced a loop to show checked state after the second menu item in the
More informationCSE 130 Programming Language Principles & Paradigms Lecture # 20. Chapter 13 Concurrency. + AJAX Discussion
Chapter 13 Concurrency + AJAX Discussion Introduction Concurrency can occur at four levels: Machine instruction level (Processor) High-level language statement level Unit level Program level (OS) Because
More informationAJAX Programming Chris Seddon
AJAX Programming Chris Seddon seddon-software@keme.co.uk 2000-12 CRS Enterprises Ltd 1 2000-12 CRS Enterprises Ltd 2 What is Ajax? "Asynchronous JavaScript and XML" Originally described in 2005 by Jesse
More informationWeb Programming/Scripting: PHP and AJAX Refresher
CS 312 Internet Concepts Web Programming/Scripting: PHP and AJAX Refresher Dr. Michele Weigle Department of Computer Science Old Dominion University mweigle@cs.odu.edu http://www.cs.odu.edu/~mweigle/cs312-f11
More informationWeb Programming Paper Solution (Chapter wise)
What is valid XML document? Design an XML document for address book If in XML document All tags are properly closed All tags are properly nested They have a single root element XML document forms XML tree
More informationCITS1231 Web Technologies. Ajax and Web 2.0 Turning clunky website into interactive mashups
CITS1231 Web Technologies Ajax and Web 2.0 Turning clunky website into interactive mashups What is Ajax? Shorthand for Asynchronous JavaScript and XML. Coined by Jesse James Garrett of Adaptive Path. Helps
More informationProgramming the World Wide Web by Robert W. Sebesta
Programming the World Wide Web by Robert W. Sebesta Tired Of Rpg/400, Jcl And The Like? Heres A Ticket Out Programming the World Wide Web by Robert Sebesta provides students with a comprehensive introduction
More informationUniversity of Washington, CSE 190 M Homework Assignment 8: Baby Names
University of Washington, CSE 190 M Homework Assignment 8: Baby Names This assignment is about using Ajax to fetch data from files and web services in text, HTML, XML, and JSON formats. You must match
More information10.1 Overview of Ajax
10.1 Overview of Ajax - History - Possibility began with the nonstandard iframe element, which appeared in IE4 and Netscape 4 - An iframe element could be made invisible and could be used to send asynchronous
More informationThe course also includes an overview of some of the most popular frameworks that you will most likely encounter in your real work environments.
Web Development WEB101: Web Development Fundamentals using HTML, CSS and JavaScript $2,495.00 5 Days Replay Class Recordings included with this course Upcoming Dates Course Description This 5-day instructor-led
More informationextc Web Developer Rapid Web Application Development and Ajax Framework Using Ajax
extc Web Developer Rapid Web Application Development and Ajax Framework Version 3.0.546 Using Ajax Background extc Web Developer (EWD) is a rapid application development environment for building and maintaining
More information6. Accelerated Development with jquery Library and AJAX Technology
Web Engineering I BIT Pre-Semester Accelerated Development with jquery Library and AJAX Technology (Modal Question) Lessons for Mid-Exam 1. Web Administration skills in Analysis, Design, Develop and Deploy
More informationMultimedia im Netz Online Multimedia Winter semester 2015/16. Tutorial 07 Minor Subject
Multimedia im Netz Online Multimedia Winter semester 2015/16 Tutorial 07 Minor Subject Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 06 (NF) - 1 Today s Agenda Recap AJAX
More informationE ECMAScript, 21 elements collection, HTML, 30 31, 31. Index 161
A element, 108 accessing objects within HTML, using JavaScript, 27 28, 28 activatediv()/deactivatediv(), 114 115, 115 ActiveXObject, AJAX and, 132, 140 adding information to page dynamically, 30, 30,
More informationPhase I. Initialization. Research. Code Review. Troubleshooting. Login.aspx. M3THOD, LLC Project Documentation
Client: J.H. Cohn Project: QlikView Login & Deployment Date: May 16, 2011 Phase I Initialization Research Obtained credentials for connecting to the DMZ server. Successfully connected and located the file
More informationWhen created, it is given a name.
Ajax Service Ajax (which is an acronym for Asynchronous JavaScript and XML) is a description for the practice of constructing web pages that have dynamic content with call-outs to external services to
More informationRKN 2015 Application Layer Short Summary
RKN 2015 Application Layer Short Summary HTTP standard version now: 1.1 (former 1.0 HTTP /2.0 in draft form, already used HTTP Requests Headers and body counterpart: answer Safe methods (requests): GET,
More informationAJAX(Asynchronous Javascript + XML) Creating client-side dynamic Web pages
AJAX(Asynchronous Javascript + XML) Creating client-side dynamic Web pages AJAX = Asynchronous JavaScript and XML.AJAX is not a new programming language, but a new way to use existing standards. AJAX is
More informationWebApp development. Outline. Web app structure. HTML basics. 1. Fundamentals of a web app / website. Tiberiu Vilcu
Outline WebApp development Tiberiu Vilcu Prepared for EECS 411 Sugih Jamin 20 September 2017 1 2 Web app structure HTML basics Back-end: Web server Database / data storage Front-end: HTML page CSS JavaScript
More informationJAVASCRIPT - CREATING A TOC
JAVASCRIPT - CREATING A TOC Problem specification - Adding a Table of Contents. The aim is to be able to show a complete novice to HTML, how to add a Table of Contents (TOC) to a page inside a pair of
More informationCSC 443: Web Programming
1 CSC 443: Web Programming Haidar Harmanani Department of Computer Science and Mathematics Lebanese American University Byblos, 1401 2010 Lebanon Today 2 Course information Course Objectives A Tiny assignment
More informationINDEX SYMBOLS See also
INDEX SYMBOLS @ characters, PHP methods, 125 $ SERVER global array variable, 187 $() function, 176 $F() function, 176-177 elements, Rico, 184, 187 elements, 102 containers,
More informationAJAX Workshop. Karen A. Coombs University of Houston Libraries Jason A. Clark Montana State University Libraries
AJAX Workshop Karen A. Coombs University of Houston Libraries Jason A. Clark Montana State University Libraries Outline 1. What you re in for 2. What s AJAX? 3. Why AJAX? 4. Look at some AJAX examples
More informationCSC Javascript
CSC 4800 Javascript See book! Javascript Syntax How to embed javascript between from an external file In an event handler URL - bookmarklet
More informationProgramming for Digital Media. Lecture 7 JavaScript By: A. Mousavi and P. Broomhead SERG, School of Engineering Design, Brunel University, UK
Programming for Digital Media Lecture 7 JavaScript By: A. Mousavi and P. Broomhead SERG, School of Engineering Design, Brunel University, UK 1 Topics Ajax (Asynchronous JavaScript and XML) What it is and
More informationPHP / MYSQL DURATION: 2 MONTHS
PHP / MYSQL HTML Introduction of Web Technology History of HTML HTML Editors HTML Doctypes HTML Heads and Basics HTML Comments HTML Formatting HTML Fonts, styles HTML links and images HTML Blocks and Layout
More informationWalking the DOM Tree. Lecture Outline. An example XHTML page. CSE 190 M (Web Programming), Spring 2008 University of Washington
Walking the DOM Tree CSE 190 M (Web Programming), Spring 2008 University of Washington References: Forbes/Steele, Chipman (much of this content was stolen from them) Except where otherwise noted, the contents
More informationUsing Development Tools to Examine Webpages
Chapter 9 Using Development Tools to Examine Webpages Skills you will learn: For this tutorial, we will use the developer tools in Firefox. However, these are quite similar to the developer tools found
More informationSections and Articles
Advanced PHP Framework Codeigniter Modules HTML Topics Introduction to HTML5 Laying out a Page with HTML5 Page Structure- New HTML5 Structural Tags- Page Simplification HTML5 - How We Got Here 1.The Problems
More informationTopics (Non-exhaustive) Hash Tables Tries Trees Stacks Queues. HTTP CSS PHP MVC SQL Javascript TCP/IP
Topics (Non-exhaustive) Hash Tables Tries Trees Stacks Queues HTTP CSS PHP MVC SQL Javascript TCP/IP Linked Lists head 2 3 9 Nodes n next typedef struct node { int n; struct node* next; } node; Search
More informationSession 18. jquery - Ajax. Reference. Tutorials. jquery Methods. Session 18 jquery and Ajax 10/31/ Robert Kelly,
Session 18 jquery - Ajax 1 Tutorials Reference http://learn.jquery.com/ajax/ http://www.w3schools.com/jquery/jquery_ajax_intro.asp jquery Methods http://www.w3schools.com/jquery/jquery_ref_ajax.asp 2 10/31/2018
More informationIntroduction to Ajax
Introduction to Ajax with Bob Cozzi What is AJAX? Asynchronous JavaScript and XML A J a X Asynchronous data retrieval using the XMLHttpRequest object from JavaScript Data is retrieved from the server as
More information