Difference between revisions of "Week Thirteen (MGDP2060)"
Karl Jones (Talk | contribs) (→Ajax) |
Karl Jones (Talk | contribs) (→Asynchronous) |
||
Line 20: | Line 20: | ||
The word 'asynchronous', or 'async' for short, means 'takes some time' or 'happens in the future, not right now'. | The word 'asynchronous', or 'async' for short, means 'takes some time' or 'happens in the future, not right now'. | ||
+ | |||
+ | === Synchronous example === | ||
+ | |||
+ | 1. Waiter takes order from table A. | ||
+ | 2. Waiter delivers order to kitchen. | ||
+ | 3. Waiter delivers food to table A. | ||
+ | 4. Waiter takes order from table B. | ||
+ | 5. Waiter delivers order to kitchen. | ||
+ | 6. Waiter delivers food to table B. | ||
+ | |||
+ | === Asynchronous example === | ||
+ | |||
+ | 1. Waiter takes order from table A. | ||
+ | 2. If table B is ready, waiter takes order from table B. | ||
+ | 3. Waiter delivers order from table A to kitchen. | ||
+ | 4. If table B is ready, waiter takes order from table B. | ||
+ | 5. If food for table A is ready, waiter delivers food to table A. | ||
+ | 6. If table B is ready, waiter takes order from table B. | ||
+ | 7. If food for table A is ready, waiter delivers food to table A. | ||
+ | 8. If table B is ready, waiter takes order from table B. | ||
+ | 9. Waiter delivers order from table B to kitchen. | ||
+ | 10. If food for table B is ready, waiter delivers food to table B. | ||
See [[Asynchronous I/O]]. | See [[Asynchronous I/O]]. |
Revision as of 13:50, 29 November 2016
This article lists topics for Week Thirteen of Web Design and Development III (MGDP2060).
Previous: Week Twelve (MGDP2060) - Next: Week Fourteen (MGDP2060)
Contents
Ajax
Ajax is a programming paradigm, widely used in web design and development.
Ajax is a number of things, the most important being the fact that JavaScript can:
- Send requests from a browser
- Receive responses from the server
- Update the browser's Document Object Model -- in other words, what the user sees (or hears) in the browser.
"Ajax" stands for "Asynchronous JavaScript and XML". This is sometimes descriptive, but not always: Ajax does not need to be asynchronous, nor does it need to use JavaScript or XML.
In practice, Ajax usually is asynchronous, and does use JavaScript, although JSON often takes the place of XML.
Asynchronous
The word 'asynchronous', or 'async' for short, means 'takes some time' or 'happens in the future, not right now'.
Synchronous example
1. Waiter takes order from table A. 2. Waiter delivers order to kitchen. 3. Waiter delivers food to table A. 4. Waiter takes order from table B. 5. Waiter delivers order to kitchen. 6. Waiter delivers food to table B.
Asynchronous example
1. Waiter takes order from table A. 2. If table B is ready, waiter takes order from table B. 3. Waiter delivers order from table A to kitchen. 4. If table B is ready, waiter takes order from table B. 5. If food for table A is ready, waiter delivers food to table A. 6. If table B is ready, waiter takes order from table B. 7. If food for table A is ready, waiter delivers food to table A. 8. If table B is ready, waiter takes order from table B. 9. Waiter delivers order from table B to kitchen. 10. If food for table B is ready, waiter delivers food to table B.
See Asynchronous I/O.
XML
Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format which is both human-readable and machine-readable.
It is used for many purposes, including RSS.
JSON
JSON is a file format for text data, widely used in web applications.
JSON is an alternative to XML.
Document Object Model
In a web browser, the Document Object Model (DOM) represents the HTML, CSS, and other parts of a web page.
Web service
A web service is a method of communication between two electronic devices over a computer network.
It is a software function provided at a network address over the World Wide Web, with the service always on, as in the concept of utility computing.
Web feed
On the World Wide Web, a web feed (news feed, syndicated feed, etc.) is a data format used for providing users with frequently updated content.
RSS
RSS (Rich Site Summary); originally RDF Site Summary; often called Really Simple Syndication, uses a family of standard web feed formats to publish frequently updated information.
Cross-origin resource sharing (CORS)
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts, JavaScript, etc.) on a web page to be requested from another domain outside the domain from which the resource originated.
WordPress to override CORS
Add this code to functions.php
:
add_action( 'pre_get_posts', 'add_header_origin' ); function add_header_origin() { if (is_feed()){ header( 'Access-Control-Allow-Origin: *' ); } }
WordPress RSS2 feed for specific category
RSS feed URL for category 7 ("Chairs"):
http://mgdp2060.x10host.com/?feed=rss2&cat=7
Resolves to:
http://mgdp2060.x10host.com/category/chairs/feed/