| 1 |
{% extends 'admin/base_site.html' %} |
| 2 |
|
| 3 |
{% block content %} |
| 4 |
<h2>Simulate long running request</h2> |
| 5 |
|
| 6 |
Set an amount of seconds and focusout of this field: |
| 7 |
<input name="seconds" /> |
| 8 |
{% endblock %} |
| 9 |
|
| 10 |
{% block footer %} |
| 11 |
{{ block.super }} |
| 12 |
<script type="text/javascript"> |
| 13 |
$(document).ready(function(){ |
| 14 |
function longRunningRequest() { |
| 15 |
$.get( |
| 16 |
'{% url "sleep" %}', |
| 17 |
{seconds: $('input[name=seconds]').val()}, |
| 18 |
function(data, textStatus, jqXHR) { |
| 19 |
longRunningRequest(); |
| 20 |
} |
| 21 |
) |
| 22 |
} |
| 23 |
|
| 24 |
$('input[name=seconds]').blur(function() { |
| 25 |
longRunningRequest() |
| 26 |
}); |
| 27 |
}); |
| 28 |
</script> |
| 29 |
{% endblock %} |