2 on('click', "#report-issue-submit", function(e){
3 $(this).html('Sending');
4 $(this).prop('disabled', true);
5 var $cancelButton = $('#report-issue-cancel');
7 $cancelButton.html('Close');
9 $('div').remove('.modal-footer-status');
11 $.ajax('/report_issue', {
13 data: $(this).parents('form').serialize()
14 }).success(function(data, status, jqxhr) {
15 var $sendButton = $('#report-issue-submit');
16 $sendButton.html('Report sent');
17 $('div').remove('.modal-footer-status');
18 $('.modal-footer').append('<div><br/></div><div class="modal-footer-status alert alert-success"><p class="contain-align-left">Thanks for reporting this issue!</p></div>');
19 }).fail(function(jqxhr, status, error) {
20 var $sendButton = $('#report-issue-submit');
21 if ($sendButton && $sendButton.prop('disabled')) {
22 $('div').remove('.modal-footer-status');
23 $('.modal-footer').append('<div><br/></div><div class="modal-footer-status alert alert-danger"><p class="contain-align-left">We are sorry. We could not submit your report! We really want this to work, though -- please try again.</p></div>');
24 $sendButton.html('Send problem report');
25 $sendButton.prop('disabled', false);
27 var $cancelButton = $('#report-issue-cancel');
28 $cancelButton.html('Cancel');