Improving alert box

Fixed error with the cancel button and upgraded the returned messages
This commit is contained in:
oslomp
2019-01-10 19:04:37 +01:00
parent d1bf9a1b90
commit e7ef899bb3

View File

@ -49,13 +49,16 @@ $(function () {
var songId = $(this).data('report-song-id'); var songId = $(this).data('report-song-id');
var message = prompt("What is wrong with the song?"); var message = prompt("What is wrong with the song?");
if (message == "") { if (message == "") {
alert("Please enter a message."); createAlert('danger', 'Please enter a message.');
return false return false
} }
if (message == null) {
return false
}
$.post('/api/report', {id: songId, msg: message, csrfmiddlewaretoken: csrf_token}, function (result) { $.post('/api/report', {id: songId, msg: message, csrfmiddlewaretoken: csrf_token}, function (result) {
console.log(result); console.log(result);
if (result.success) { if (result.success) {
alert("Thanks for the report!"); createAlert('success', 'Thanks for your song report!');
} }
}); });
return false; return false;