(2) (20%) Suppose you are implementing an XMall webpage, using index.html, script.js and loadShops.php. Index.html has...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
(2) (20%) Suppose you are implementing an XMall webpage, using index.html, script.js and loadShops.php. Index.html has been provided as follows: Index.html XMall Welcome to XMall! Fashion Sports Electronics Dining The behavior of the webpage is as follows. The very first time a client accesses the page, it shows the categories of shops in the mall (Fig. 3-1). Whenever the client clicks a category, the page displays shops belonging to the category in the "shopdiv" division (e.g., Fig. 3-2), without reloading the entire page. Meanwhile, the webpage always remembers the category that the client has clicked most recently, such that the next time the client loads index.html again using the same browser, the webpage automatically shows recommended shops in that category in the "shopdiv" division. For example, if the last category the client has clicked before reloading index.html is "Fashion", then the webpage shows up as in Fig. 3-3 when loaded. Welcome to XMall! Fashion Sports Electronics Dining Fig. 3-1 Welcome to XMall! Fashion Sports Electronics Dining Shops G2000: G2000 offers quality yet affordable professional business attire UNIQLO: Men, women and children clothing Gap: American-style casual clothing Fig. 3-2 Welcome to XMall! Fashion Sports Electronics Dining Hot Picks UNIQLO: Men, women and children clothing Gap: American-style casual clothing Fig. 3-3 Suppose a database "xmall" has been created on a MySQL database server sqldb.xmall.com, which can be accessed using login ID "admin" and password "supersecure". A table has been created in the database and a number of shop records have been inserted into the table using the follows SQL statements: CREATE TABLE shops ( shopID int (11) NOT NULL, shopName varchar (20) NOT NULL, category varchar (20) NOT NULL, description longtext NOT NULL, recommendedOrNot varchar (5) NOT NULL, PRIMARY KEY (shopID) insert into shops values (1, 'G2000', 'Fashion', 'G2000 offers quality yet affordable professional business attire', 'N'); insert into shops values (2, 'UNIQLO', 'Fashion', 'Men, women and children clothing', insert into shops values (3, 'Gap', 'Fashion', 'American-style casual clothing', 'Y'); insert into shops values (4, 'Fortress', 'Electronics', 'Hong Kong professional chain of electrical retail stores', 'Y'); insert into shops values (5, 'Broadway', 'Electronics', 'Your e-consultant', 'N'); Page 7 of 20 Implement script.js and loadShops.php, such that the above described functionalities of the webpage are achieved. Some further clarifications/requirements are as follows: (i) Your code should always remember the category which has just been clicked, using which you can retrieve recommended shops from the database for display in the "shopdiv" division when UID index.html is reloaded. You should think carefully whether this can be achieved using localStorage object or the cookie technology, and write the code accordingly. (ii) Display "Shops" and "Hot Picks" as elements, and the shop names and descriptions in elements. When a category is clicked, under the "Shops" heading, all shops in that category in the database table should be retrieved and displayed; when index.html is reloaded, under the "Hot Picks" heading, only recommended shops in the remembered category are retrieved and displayed (whose recommendedOrNot field value is 'Y' in the database table). In both cases, use the same loadShops.php for loading shop records from the database and sending them to the client. (iii) In script.js, use jQuery for AJAX requests, DOM manipulation, and event handling. Script.js (2) (20%) Suppose you are implementing an XMall webpage, using index.html, script.js and loadShops.php. Index.html has been provided as follows: Index.html XMall Welcome to XMall! Fashion Sports Electronics Dining The behavior of the webpage is as follows. The very first time a client accesses the page, it shows the categories of shops in the mall (Fig. 3-1). Whenever the client clicks a category, the page displays shops belonging to the category in the "shopdiv" division (e.g., Fig. 3-2), without reloading the entire page. Meanwhile, the webpage always remembers the category that the client has clicked most recently, such that the next time the client loads index.html again using the same browser, the webpage automatically shows recommended shops in that category in the "shopdiv" division. For example, if the last category the client has clicked before reloading index.html is "Fashion", then the webpage shows up as in Fig. 3-3 when loaded. Welcome to XMall! Fashion Sports Electronics Dining Fig. 3-1 Welcome to XMall! Fashion Sports Electronics Dining Shops G2000: G2000 offers quality yet affordable professional business attire UNIQLO: Men, women and children clothing Gap: American-style casual clothing Fig. 3-2 Welcome to XMall! Fashion Sports Electronics Dining Hot Picks UNIQLO: Men, women and children clothing Gap: American-style casual clothing Fig. 3-3 Suppose a database "xmall" has been created on a MySQL database server sqldb.xmall.com, which can be accessed using login ID "admin" and password "supersecure". A table has been created in the database and a number of shop records have been inserted into the table using the follows SQL statements: CREATE TABLE shops ( shopID int (11) NOT NULL, shopName varchar (20) NOT NULL, category varchar (20) NOT NULL, description longtext NOT NULL, recommendedOrNot varchar (5) NOT NULL, PRIMARY KEY (shopID) insert into shops values (1, 'G2000', 'Fashion', 'G2000 offers quality yet affordable professional business attire', 'N'); insert into shops values (2, 'UNIQLO', 'Fashion', 'Men, women and children clothing', insert into shops values (3, 'Gap', 'Fashion', 'American-style casual clothing', 'Y'); insert into shops values (4, 'Fortress', 'Electronics', 'Hong Kong professional chain of electrical retail stores', 'Y'); insert into shops values (5, 'Broadway', 'Electronics', 'Your e-consultant', 'N'); Page 7 of 20 Implement script.js and loadShops.php, such that the above described functionalities of the webpage are achieved. Some further clarifications/requirements are as follows: (i) Your code should always remember the category which has just been clicked, using which you can retrieve recommended shops from the database for display in the "shopdiv" division when UID index.html is reloaded. You should think carefully whether this can be achieved using localStorage object or the cookie technology, and write the code accordingly. (ii) Display "Shops" and "Hot Picks" as elements, and the shop names and descriptions in elements. When a category is clicked, under the "Shops" heading, all shops in that category in the database table should be retrieved and displayed; when index.html is reloaded, under the "Hot Picks" heading, only recommended shops in the remembered category are retrieved and displayed (whose recommendedOrNot field value is 'Y' in the database table). In both cases, use the same loadShops.php for loading shop records from the database and sending them to the client. (iii) In script.js, use jQuery for AJAX requests, DOM manipulation, and event handling. Script.js
Expert Answer:
Related Book For
Fundamental financial accounting concepts
ISBN: 978-0078025365
8th edition
Authors: Thomas P. Edmonds, Frances M. Mcnair, Philip R. Olds, Edward
Posted Date:
Students also viewed these computer network questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
1. You are the audit partner in charge of five audits which have recently been completed. You are reviewing the files and you now only have to decide which form of audit report you will sign off....
-
A satellite is in a circular orbit about the earth (ME = 5.98 1024 kg). The period of the satellite is 1.20 104 s. What is the speed at which the satellite travels?
-
Which type of conflict increases knowledge about what problem persists and solution for the stated problem? Functional conflict Dysfunctional conflict Intrapersonal conflict Interpersonal conflict
-
An 1100-kg car stops at a red light, going from \(85 \mathrm{~km} / \mathrm{h}\) to stationary in 20 s. (a) What is the impulse delivered to the car? (b) What is the average vector sum of forces...
-
Resset Co. provides the following results of Aprils operations: F indicates favorable and U indicates unfavorable. Applying the management by exception approach, which of the variances are of...
-
using deal and grove formula, Create a matlab code to show the General relationship for thermal oxidation of silicon using dry oxidation and wet oxidation. The solid line represents the general...
-
How can firms use AI to drive radical or disruptive innovation, and what are some examples of firms that have successfully leveraged AI to create new products or services that fundamentally...
-
Paul was trying to sell his accounting practice together with the office building from which it operated. Janine was interested in purchasing as she wanted to work closer to home and she liked the...
-
1) As a valve is opened, water flows through the diffuser shown in Figure at an increasing flowrate so that the velocity along the centerline is given by; V-ui-V.(1-c)(1-x/L)i where V., c, and L are...
-
You are the facility services director for a small, but important, nonprofit organization that helps protect and relocate spouses who are the victims of abuse. Wanting to make an improvement to its...
-
Think about ways to prevent discrimination (blatant or not) during the hiring process. If you had to provide advice to those in your organization conducting the interviews, what would it be regarding...
-
As an up-and-coming operations manager at a US apparel company, you have been assigned to work in the company's Cambodia office. The company has many local suppliers and a garment factory in...
-
Given the following core drilling information, metal prices and a tonnage factor of 0.45 m 3 /tonne for the Tolbert mineralized zone: (25 points) Calculate, the ore reserve characteristics using the...
-
(a) How far away can a human eye distinguish two ear headlights 2.0 m apart? Consider only diffraction effects and assume an eye pupil diameter of 5.0 mm and a wavelength of 550 nm. (b) What is the...
-
At the end of the year, Clausel Jewelers had the following items in inventory: Required a. Determine the amount of ending inventory using the lower-of-cost-or-market rule applied to each individual...
-
The following information was drawn from the balance sheets of two companies: Required a. Compute the debt to assets ratio to measure the level of financial risk of both companies. b. Compare the two...
-
Vaughn Enterprises has two hourly employees, Lane and Adam. Both employees earn overtime at the rate of 1½ times the hourly rate for hours worked in excess of 40 per week. Assume the Social...
-
Which of the following is a discrete probability distribution? Approach In a discrete probability distribution, the sum of the probabilities must equal 1, and all probabilities must be between 0 and...
-
Graph the discrete probability distribution given in Table 1 from Example 2. Approach In the graph of a discrete probability distribution, the horizontal axis represents the values of the discrete...
-
Compute the mean of the discrete random variable given in Table 1 from Example 2. Approach Find the mean of a discrete random variable by multiplying each value of the random variable by its...
Study smarter with the SolutionInn App