Difference between revisions of "Week Thirteen Exercises (MGDP2060)"
Karl Jones (Talk | contribs) (Created page with "This article contains '''exercises''' for '''Week Thirteen''' of Web Design and Development III (MGDP2060). == In class == ... == For next...") |
Karl Jones (Talk | contribs) |
||
| Line 1: | Line 1: | ||
This article contains '''exercises''' for '''[[Week Thirteen (MGDP2060)|Week Thirteen]]''' of [[Web Design and Development III (MGDP2060)]]. | This article contains '''exercises''' for '''[[Week Thirteen (MGDP2060)|Week Thirteen]]''' of [[Web Design and Development III (MGDP2060)]]. | ||
| − | == | + | == Ajax== |
| − | . | + | Create a folder named '''ajax''' on your exercise web server. |
| − | + | Create a document named '''index.html'''. | |
| − | ... | + | Enter HTML and JavaScript which retrieves RSS data and displays the data, |
| + | similar to this example: | ||
| + | |||
| + | http://code.karljones.com/ajax/wordpress-rss-ajax-2.html | ||
| + | |||
| + | Modify the code so it displays one of your product lines. | ||
| + | |||
| + | Browse the page, and confirm that it displays the items in your product line. | ||
| + | |||
| + | Add a product to that line. Browse again, to confirm that the new product displays. | ||
| + | |||
| + | == WordPress CORS == | ||
| + | |||
| + | Add this code to the functions.php file in your WordPress exercise installation: | ||
| + | |||
| + | <pre> | ||
| + | add_action( 'pre_get_posts', 'add_header_origin' ); | ||
| + | |||
| + | function add_header_origin() { | ||
| + | if (is_feed()){ | ||
| + | header( 'Access-Control-Allow-Origin: *' ); | ||
| + | } | ||
| + | } | ||
| + | </pre> | ||
| + | This is so other users (the instructor, in this case) can access your RSS feed. | ||
| + | |||
| + | == Project == | ||
| + | |||
| + | • Work on your project. | ||
[[Category:Web Design and Development III (MGDP2060)]] | [[Category:Web Design and Development III (MGDP2060)]] | ||
Latest revision as of 16:59, 1 December 2016
This article contains exercises for Week Thirteen of Web Design and Development III (MGDP2060).
Ajax
Create a folder named ajax on your exercise web server.
Create a document named index.html.
Enter HTML and JavaScript which retrieves RSS data and displays the data, similar to this example:
http://code.karljones.com/ajax/wordpress-rss-ajax-2.html
Modify the code so it displays one of your product lines.
Browse the page, and confirm that it displays the items in your product line.
Add a product to that line. Browse again, to confirm that the new product displays.
WordPress CORS
Add this code to the functions.php file in your WordPress exercise installation:
add_action( 'pre_get_posts', 'add_header_origin' );
function add_header_origin() {
if (is_feed()){
header( 'Access-Control-Allow-Origin: *' );
}
}
This is so other users (the instructor, in this case) can access your RSS feed.
Project
• Work on your project.