Question: AJAX code to write: When the search page is requested with the URL http://localhost:3000/search and it first loads, at the top of the page there

AJAX code to write: When the search page is requested with the URL http://localhost:3000/search and it first loads, at the top of the page there should be a form, and beneath it should be a table containing all of the homes. The data to display all of the homes should be fetched using AJAX and the All route above. You can use either jQuery or the fetch API to make the AJAX request. The form should include an All button that allows the user to populate the table with all of the housing data, again by using an AJAX request to the server.

The form should give the user a row of buttons that allow them to filter by community (Mountain, Ancaster, etc.).

The form should give the user a dropdown selection box with options in order to select a bedroom number: 1, 2, 3, 4, 5, 6, 7. Next to this dropdown should be a button that allow them to Filter By Bedroom.

The form should give the user a dropdown selection box with options in order to select a bathroom number: 1, 2, 3, 4, 5, 6, 7. Next to this dropdown should be a button that allow them to Filter By Bathroom.

The form should give the user two input textboxes with appropriate labels that allow the user to enter a min and max price. Next to these should be a button that allows them to Filter By Price.

All of these filter functionalities should be handled by making an AJAX request to the associated route (e.g. localhost:3000/price_search in the case of filtering by price). The form input values provided should be used as the query parameters. The filtered data returned from the AJAX request should be used to re-construct the table such that it only contains the filtered elements. Only one filter should be applied at a time, after each button click. In the case of the All button being clicked, none of the filters will be applied.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!