{% extends "base.html" %} {% load nst %} {% block pagetitle %}Search{% endblock %} {% block content %}
{{ form.query }}
{% endblock %} {% block ready %} function search_success(html) { $('#search-results .oneliners').html($(html).html()); bind_details_trigger($('#search-results div.oneliners')); $('#search-results').show(); } function search_error(err) { $('#search-errors').show(); } function search_completed() { $('#search-loading').css('visibility', 'hidden'); } $('#search-form').submit(function(e) { e.preventDefault(); $('#search-loading').css('visibility', 'visible'); $('#search-errors').hide(); var options = { 'url': '{% url bashoneliners.main.views.search_ajax %}', 'type': 'POST', 'data': { 'query': $('#id_query').val() }, 'success': search_success, 'error': search_error, 'complete': search_completed }; $.ajax(options); }); $('#id_query').focus(); {% endblock %}