[Answered ]-Django ajax load() – possible to update two or more divs, with part of the returned django view context?

2πŸ‘

βœ…

use

$.get(url, [{key:value}], function(data){
    //data is the entired contents of going to that url.
    //split it up here and do your stuff

    $('#div1').html(piece1);
    $('#div2').html(piece2);
});

http://docs.jquery.com/Ajax/jQuery.get

edit: looking more closely at your question, you will need to also create a django template for the view which you’re calling with url that will give all the information you want to the javascript function.

πŸ‘€Brandon Henry

0πŸ‘

I feel like a broken record by giving this answer, but you really want to check out the jQuery Taconite Plugin. It does what you asked for and 500% more. Checkout the examples and be amazed. I don’t use this word lightly, but this is a truly elegant solution.

πŸ‘€Peter Rowell

Leave a comment