Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8107223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:41:49+00:00 2026-06-06T00:41:49+00:00

I’m learning Python, Django, Javascript and jQuery by trying to build a simple shopping

  • 0

I’m learning Python, Django, Javascript and jQuery by trying to build a simple shopping list web application. I’d like to hear from experienced developers if my approach is correct:

Functionality:
Web page will display a list of foods. When I click on a certain food I want a list of ingredients to get displayed (this will be my shopping list). Clicking another food will add more ingredients to the shopping list.

My approach:
I have built a simple page with django. I’m able to display a list of all foods that have been entered to the database. What I need now is to start building a list of ingredients as I click on food items.

I was thinking I would load a list of ingredients from the database on the first page load but hide them with css. When I click on a food item I would un-hide the ingredients associated with the food item by using jquery/css.

This approach seems quite clumsy to me. Could you give me some advice how I could create my shopping list application using the technologies mentioned above? Is my approach correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:41:51+00:00Added an answer on June 6, 2026 at 12:41 am

    Here’s how I’d do it. But note that there will be no right answer to this question.

    Lets call the page where you click on foods, index.php.

    On index, I’d have all the foods that could be clicked, as well as an empty div with the id “ingredients” — eg. <div id="ingredients"></div>

    When foods were clicked, they’d call jQuery handlers in main.js.

    The onClick handlers would:

    • Keep track of the currently selected foods
    • Send a json or otherwise formatted list to a get_ingredients.php page via AJAX.
    • (This page would return the HTML I’d want to display in the “Ingedients” section)
    • Set the content of the ingredients div with the html returned by the AJAX call.

    More explicitly, get_ingredients.php would:

    • Parse the GET/POST list of foods that was sent (via AJAX) by index
    • Query the database to see what ingredients were necessary for the selected foods
    • Construct HTML corresponding to the query results that should be put into the “ingredients” div on the user-facing page.
    • “display it” via echo/print/printf/etc, this isn’t really displayed with AJAX, but rather sent as the AJAX response.

    This way, you only have to keep track of the selected foods, and not deal with adding/subtracting individual ingredient quantities when foods are selected and deselected.

    This has the downside of re-transmitting things “you already know”, namely the ingredients of foods that were previously selected, however it eliminates a lot of the work that would otherwise be required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to render a haml file in a javascript response like so:
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
Seemingly simple, but I cannot find anything relevant on the web. What is the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.