Modified the episode modal so that we are now resetting the button after a request

pull/470/head
tidusjar 8 years ago
parent 6f008f77a3
commit 8677d96ed8

@ -576,15 +576,12 @@ $(function () {
// Save Modal click // Save Modal click
$("#episodesRequest").click(function (e) { $("#episodesRequest").click(function (e) {
e.preventDefault(); e.preventDefault();
var origHtml = $('#episodesRequest').html();
var tvId = $('#selectedEpisodeId').val(); var tvId = $('#selectedEpisodeId').val();
$("#episodesRequest").prop("disabled", true);
loadingButton("episodesRequest", "primary"); loadingButton("episodesRequest", "primary");
var $form = $('#form' + tvId); var $form = $('#form' + tvId);
var model = []; var model = [];
var $checkedEpisodes = $('.selectedEpisodes:checkbox:checked'); var $checkedEpisodes = $('.selectedEpisodes:checkbox:checked');
@ -601,10 +598,28 @@ $(function () {
Episodes: model Episodes: model
} }
var url = createBaseUrl(mainBaseUrl, "search/request/tvEpisodes"); var methodUrl = createBaseUrl(mainBaseUrl, "search/request/tvEpisodes");
var type = $form.prop('method'); var methodType = $form.prop('method');
$('#episodesModal').modal('toggle'); $('#episodesModal').modal('toggle');
sendRequestAjax(JSON.stringify(finalObj), type, url, tvId);
$.ajax({
type: methodType,
url: methodUrl,
data: JSON.stringify(finalObj),
dataType: "json",
success: function (response) {
finishLoading("episodesRequest", "primary", origHtml);
if (response.result === true) {
generateNotify(response.message);
} else {
generateNotify(response.message, "warning");
}
},
error: function(e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
}
});
}); });
function buildSeasonsContext(result) { function buildSeasonsContext(result) {

Loading…
Cancel
Save