Django for Designers/CRUD: Difference between revisions

imported>Aldeka
imported>Aldeka
Line 362:
 
<div class="instructor">What are we doing here? First, we're turning our request.POST test into a true choice -- we no longer go on to send back the full index.html rendered template if the request is a POST. Second, if we manage to create a bookmark successfully, we send back just our bookmark.html -- not the full index.html -- rendered with the data for our new bookmark.</div>
 
Finally, let's edit the success function in our script.js file to use this rendered data instead of printing nonsense:
 
<source lang="javascript">
success: function(data){
$('.error').hide();
$('.bookmarks').prepend(data);
}
</source>
 
Reload your development server and your web page, and try creating a bookmark. It should appear right away on the page now!
Anonymous user