1

I am trying to load a django url into a div using the jquery .load() function and no content is appearing in the div. I am pretty sure it is not loading at all because if I use firebug it shows no content.

Here is the load function being called:

$(document).ready(function(){
    $("#create").click(function(){
        $("#popupContact").load("/cookbook/createrecipe");
    });
});

here is my template:

//snip
    <div id="popupContact" class="popup">
        <a id="popupContactClose" style="cursor:pointer;float:right;">x</a>                        
    </div>
    <div id="backgroundPopup">
    </div>  
//snip

here is the element with create id:

{% block footer %}
        <div id="create" style="cursor:pointer" >Create New Recipe</div>
{% endblock %}

The link /coookbook/createrecipe worked fine when it was being used in "a" link tag but when I tried to switch over to loading content it would no longer work

Thanks for any help

snackerfish

6
  • Where is the element with the create id? Commented Apr 21, 2012 at 23:36
  • i have added it to my question Commented Apr 21, 2012 at 23:39
  • What HTTP status doest FireBug show for ajax response? There can be a problem with CSRF verifying, but I'm not sure. Commented Apr 21, 2012 at 23:52
  • Have you set a breakpoint in the jQuery code? Is it being reached? Commented Apr 22, 2012 at 0:02
  • i dont think the ajax is being loaded at all because I dont see any response in net -> xhr Commented Apr 22, 2012 at 0:50

1 Answer 1

1

I moved the javascript code from my template to my base.html template and it seemed to work fine

thank you

snackerfish

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.