{% extends "base.html" %} {% set active_page = "plugins" %} {% block title %} Plugins {% endblock %} {% block styles %} {{ super() }} {% endblock %} {% block script %} $(function(){ $('input[type=checkbox]').change(function(e) { var checkbox = $(this); var form = checkbox.closest('form'); var url = form.attr('action'); $.ajax({ type: 'POST', url: url, data: form.serialize(), success: function(data) { if( data.indexOf('failed') != -1 ) { alert('Could not be toggled.'); } } }); }); }); {% endblock %} {% block content %}