Mercurial > public > sg101
view downloads/static/js/downloads-get.js @ 989:2908859c2fe4
Smilies now use relative links.
This is for upcoming switch to SSL. Currently we do not need absolute URLs for
smilies. If this changes we can add it later.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 29 Oct 2015 20:54:34 -0500 |
parents | ee87ea74d46b |
children | f56798c96ec2 |
line wrap: on
line source
$(document).ready(function() { $('.dl-button').each(function(n) { var button = $(this); var id = button.attr('id'); var numeric_id = -1; if (id.match(/dl-(\d+)/)) { numeric_id = RegExp.$1; } button.click(function() { button.attr('disabled', 'disabled').val('Getting link, stand by...'); $.ajax({ url: '/downloads/request/', type: 'POST', data: { id: numeric_id }, dataType: 'json', success: function(result) { var link_id = result.id; var div = $('#link-' + link_id); div.hide(); div.html( 'Thank you! Your download is now ready. <a href="' + result.url + '">Click here to download</a>.'); div.fadeIn(3000); }, error: function (xhr, textStatus, ex) { alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + xhr.responseText); } }); }); }); });