load django form into template after initial page load
I created a django form and want to display it in a light box after someone clicks a button on my html page. besides loading the form on the initial page load, i also wanted to call the view which displays the form with javascript. is there a way to only load the form template without reloading the entire webpage? 开发者_如何学C I want to do this incase there are errors on the form so that I could just reload the lightbox with the form and error messages instead of the entire page.
Thanks!
Return just the HTML for the form from a separate view, then call the view via XHR. Once you've received the HTML, just replace what is already in the appropriate div.
精彩评论