Mercurial > public > sg101
view contests/static/js/contests/contests.js @ 973:6f55c086db1e
Guess file extension based on content-type.
When downloading a file, and no path is supplied to store it, guess the file
extension using mimetypes and the content-type header.
Also supply a unit test for the HotLinkImageForm.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 01 Oct 2015 19:44:45 -0500 |
parents | ee87ea74d46b |
children | 16e190fa6ef8 |
line wrap: on
line source
$(function() { var $button = $('#contest-button'); $button.click(function() { var buttonLabel = $button.text(); $button.attr('disabled', 'disabled').val('Please wait...'); $.ajax({ url: '/contests/enter/', type: 'POST', data: { contest_id : contest_id }, dataType: 'json', success: function (data, textStatus) { var classname = data.entered ? 'success' : 'info'; var $p = $('#contest-entry'); $p.hide(); $p.addClass(classname); $p.html(data.msg); $p.fadeIn(3000); }, error: function (xhr, textStatus, ex) { alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + xhr.responseText); $button.removeAttr('disabled').text(buttonLabel); } }); return false; }); });