{% extends "base.html" %} {% set active_page = "new" %} {% block title %} {% if to %} Reply to {{ to }} {% else %} New Message {% endif %} {% endblock %} {% block script %} $(function(){ $("#message_form").submit(function(e) { e.preventDefault(); var form = $(this); var url = form.attr('action'); $.ajax({ type: "POST", url: url, data: form.serialize(), success: function(data) { if( data.error ) { if( data.error.indexOf('404') != -1 ) alert('Fingerprint not found.'); else if( data.error.indexOf('aborted') != -1 ) alert('Empty or invalid message.'); else alert(data.error); return; } alert("Message sent!"); document.location.href = "/inbox"; } }); }); }); {% endblock %} {% block content %}
{% endblock %}