Build a web page that looks and behaves similarly to the one you built for the previous assignment. However, the new page must be implemented differently.
<style>
region, and you may not use style attributes in elements.
(This requirement represents poor web design, but it gives you experience
styling items with JavaScript.)
fetch() method in JavaScript.
The AJAX response must be in JSON, formatted like this (white space is
insignificant, and you must quote field names):
{
"category": "snacks",
"accesses": 42,
"details": [
{
"item": "olive hash",
"description": "mashed olives in gravy",
"price": 2.50
},
{
"item": "smarties",
"description": "small savory bites",
"price": 1.50
},
{
"item": "clumpers",
"description": "chocolate-covered raisins",
"price": 1.50
}
]
}
Updating the data must not cause the
current page to be reloaded.
As before, your web page should be self-contained and it should validate without warnings or errors. The CGI program may be written in PHP (preferably) or Python, Perl, or Java. The AJAX call must invoke the same CGI program that generates the original page.
To get extra credit, you must document the extra work, preferably in a comment in your CGI program.
Turn in your CGI program (a single file called cafe-3.php
or cafe-3.cgi or a ZIP package containing your CGI program and a template
file) via Canvas.