Difference between revisions of "Week Thirteen (MGDP2060)"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Ajax)
Line 13: Line 13:
 
* Update the browser's [[Document Object Model]] -- in other words, what the user sees (or hears) in the browser.
 
* 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.
+
"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 ==
 
== Asynchronous ==

Revision as of 14:38, 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)

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'.

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/

Exercises

See Week Thirteen Exercises (MGDP2060).