Category: JQuery

Django And JQuery Ajax, Part 2: Forms

This article is a follow up to an article you can read here about using Django and JQuery to load paginated subpages. That article explains some of the principles that will be used again here. In this article I will show a simple way to integrate Django forms seamlessly into another page using JQuery ajax functions. The integration is kept as straightforward as possible, making sure csrf tokens, validation, error messages, and redirects work just the same way as they do on the original, non Ajax-integrated form.

Read more ...

Django And JQuery AJAX, Part 1: Loading Paginated Subpages

This tutorial teaches a simple way to use JQuery's AJAX functionality to integrate paginated webpages, represented by Django's ListView, into the DOM of another webpage. The implementation makes very few assumptions about the included page, using its html code rather than json objects, which would require further processing. This is meant to make usage of the script very straightforward even with little knowledge of what the included webpage or its data look like. The backend is written in Django and uses some of its useful features to keep the page integration DRY and consistent. However the JQuery part by itself can be used in combination with other frameworks as well, or even with plain PHP pages. The pagination of the original, included page will be converted into an expanding list on the AJAX page, where additional pages are subsequently added to the end of the previously loaded pages. So let's get started.

Read more ...