javascript to reload django partial 1

javascript to reload django partial

// Where tag_cloud is the id of the Div you are reloading (Note the space before the 2nd #)
$('#tag_cloud').load(' #tag_cloud', function(){$(this).children().unwrap()})

Here is what the above code is Doing:
1. The first line is the jQuery selector. It’s selecting the div with the id of tag_cloud.
2. The second line is the jQuery load function. It’s loading the contents of the div with the id of tag_cloud from the current page.
3. The third line is the callback function. It’s unwrapping the contents of the div with the id of tag_cloud.

The reason you need to unwrap the contents of the div is because the load function wraps the contents of the div in a div.

Similar Posts