COMP3322A Modern Technologies on World Wide Web Midterm Examination
Student Number: ____________________Name: _____________________
Date: October 29, 2019 Time: 10:40-11:40am
Total mark: 100
Copyright By PowCoder代写 加微信 powcoder
You are going to implement a simple Express web app as follows. When you load the web page at http://127.0.0.1:8081/index.html in a new browser session, you see a page view as in Fig. 1. While you are entering a product category into the input box, some predefined categories whose starting letters match what you are entering will be shown in a dropdown list, as shown in Fig. 2.
Fig. 1 Fig. 2
After you have finished entering the category and clicked the ¡°Submit¡± button, a list of products in the category will be retrieved from the server side and displayed underneath the category input on the page, as shown in Fig. 3.
In addition, suppose you have retrieved some products earlier in a browser session; in the same browser session, if you load the page again by entering http://127.0.0.1:8081/index.html in the address bar and pressing ¡°enter¡±, you will see a page as shown in Fig. 4 (assume products in the ¡°Clothing¡± category is what you last retrieved in this browser session), i.e., the ¡°Product Category¡± input box is empty, while the list of products are displayed underneath.
Complete index.html and App.js which are partially given below, to implement the above web app.
1 (40 marks). In index.html:
(1) Implement the input box following ¡°Product Category¡± using HTML5
(3) Implement the retrieveProductList() function, which is invoked when the ¡°Submit¡± button in the HTML form is clicked. In the function, disable the default form submission behavior; send an AJAX HTTP request to the server side according to the method and URL defined in the