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

  • Home
  • SEARCH
  • 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 7928507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:45:06+00:00 2026-06-03T19:45:06+00:00

I need a solution to this problem: I have a django site that displays

  • 0

I need a solution to this problem:

I have a django site that displays all recipes in a recipe list

each of these recipes is a link that when clicked should load the fields of that recipe into a popupdiv

so far I have the popup div all set – now i just need to figure out how to access the recipe fields of that button.

basically the content i would like to load is recipe.name recipe.author recipe.steps etc
but i don’t know how to.

Right now I also have a form being loaded into the div using ajax so I don’t want to interfere in anyway with the ajax call (i will post this code as well). Would it make sense to also use ajax for a problem like this?

here is my button click function

$(document).ready(function(){

    $(".button").click(function(){
        var content = $("#popupContact").load($('#recipe'));
    });
});

here is the template for my page:

{% block content %}
{% autopaginate recipe_list 6 %}
    <div id="recipe_cont">
            {% for recipe in recipe_list %}
        <div class="recipe">
            <div class="button">//here is the button that is clicked to load recipe 
            <a href="{% url cookbook.views.userrecipe recipe.id %}" style="display: none;"></a>   
            <img src="{{ STATIC_URL }}chicknbraw.jpg" alt="" height="70" width="70" style="display:inline;" />
            <h4>{{ recipe.name }}</h4>
             </div>
            <h5>{{ recipe.author }}</h5>
            <h5>Prep Time: {{ recipe.prep_time }} minutes</h5>

            <h6><a href="/addrecipe/{{ recipe.id }}">Add Recipe</a>
                <a href="/removerecipe/{{ recipe.id }}">Remove Recipe</a></h6>
        </div>
    {% endfor %}
    </div>

    <div id="popupContact" class="popup">//load recipe information into this div
            <a id="popupContactClose" style="cursor:pointer;float:right;">x</a>
            <p id="contactArea">
            <h1 style="text-align:center">Create New Recipe</h1>
            {% include 'cookbook/create_form.html' %} //this is for the form that is loaded. Is there a way to include a different template? Maybe have multiple contactAreas and hide/show different ones depending on what is being loaded?
            </p>
    </div>
    <div id="backgroundPopup">
    </div>  
    <div id="col2-footer">
    {% paginate %}
    <p id="recipe_order_text"> order by: <a href="/userbook/ordered/name">abc</a>|<a href="/userbook/ordered/date">date</a> 
    </div>

{% endblock %}

here is the form ajax call:

$(document).ready(function(){

    function hijack() {
        var form = $('form#createrecipeform');
        form.each (function(){
            this.reset();
            });
        form.submit(function(e) {
            e.preventDefault();
            console.log('ajax form submission function called successfully.');
            //form = $(this);
            console.log(form)
            var serialized_form = form.serialize();
            $.ajax({ type: "POST", 
                url: $(this).attr('action'),
                data: serialized_form, 
                success: (function(data) { 
                    console.log('ajax success function called successfully.');
                    data = $.parseJSON(data);
                    if (data.success) {
                        console.log('success');
                    } else {        
                        console.log('failure');
                        var newForm = data.form;
                        form.replaceWith(newForm);
                        hijack();
                    }
                })
            });
            return false;
        });
    };

    hijack();

});

thanks a lot for any solutions you may have

katie

  • 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-03T19:45:08+00:00Added an answer on June 3, 2026 at 7:45 pm

    I ended up creating a div that is hidden for each recipe that is loaded and then used .html() to place each of the divs wihtin the popup

    this ended up working perfectly – better then replaceWith append or clone

    thank you for your help @akhaku

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

Sidebar

Related Questions

I have Solution with web site MyProject. I need publish this web site. In
I encounter this problem : I have a django (python) server that serve XML
So, I have looked everywhere for a solution to this problem I have and
I have this problem... I need to load an image from the resources of
I need a solution for the following problem: I will have a table in
I've been searching the net but couldn't find a solution for this. I need
This doesn't need to be a real time solution, but are there some log
I edited this question after i found a solution... i need to understand why
Simple question: I need a solution so that I can find, lets say names,
I need a quick solution of javascript spell checking. Although all the browsers underlines

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.