Hi,
I'm using the load method to replace the contents of ONE div.
$( '#ajax_tbody_result' ).html( ' ' ).load(url);
Now I'm wondering whether it is possible to call the url, get the return values, split them up and update TWO or more divs in my template.
Thus the solution would be to get some objects out of the returned django context, split it up and update the divs with the correct content. This is the returned context:
context = {
'object_list' : contact_list_page,
'headers': headers,
'filter_by_classification_form': filter_by_classification_form,
'filter_by_address_form': filter_by_address_form,
'filter_by_company_form': filter_by_company_form,
'urlquerystring_previous_page' : urlquerystring_previous_page,
'urlquerystring_next_page' : urlquerystring_next_page,
}
Edit: The solution:
Split up the html response of a jquery get request into its parts and update the corresponding parts in the .html. You can do it like this:
$.get(url, function(results){
var table = $("table", results);
var spans = $("span.step-links", results);
//update the ajax_table_result with the return value
$('#ajax_table_result').html(table);
$('.step-links').html(spans);
}, "html");
The results object is the django template rendered to .html. From this .html return I take the stuff that I need (the table and the span with the id step-links) and update the corresponding objects in my page.