Django for Designers/CRUD: Difference between revisions

imported>Aldeka
imported>Aldeka
Line 294:
If you try this out, you'll see that our JS-y form makes real bookmarks, just like the old version of our form did! However, it's putting junk in our bookmarks list on the page; we have to reload to actually see the bookmark our ajax call created.
 
There's several ways we could fix this. <div class="instructor">We could make our views.py send back a JSON serialization of our bookmark data, and have our JS file turn that into a list element somehow (using either a JS template or a giant string). Or we could have Django do the template rendering for us, and send our JS script the raw HTML we want it to use. This is called AHAH (Asychronous HTML and HTTP), or sometimes PJAX.</div>
 
For the sake of speed and simplicity, we'll go with the latter. First, though, we need to refactor our templates a little.
Anonymous user