diff --git a/PlexRequests.UI/Views/Admin/Sonarr.cshtml b/PlexRequests.UI/Views/Admin/Sonarr.cshtml index 6ca64285d..fd50071f5 100644 --- a/PlexRequests.UI/Views/Admin/Sonarr.cshtml +++ b/PlexRequests.UI/Views/Admin/Sonarr.cshtml @@ -130,34 +130,40 @@ @if (!string.IsNullOrEmpty(Model.QualityProfile)) { + - var qualitySelected = @Model.QualityProfile; - if (!qualitySelected) { - return; - } - var $form = $("#mainForm"); - $.ajax({ - type: $form.prop("method"), - data: $form.serialize(), - url: "sonarrprofiles", - dataType: "json", - success: function(response) { - response.forEach(function(result) { - if (result.id == qualitySelected) { - $("#select").append(""); - } else { - $("#select").append(""); - } - }); - }, - error: function(e) { - console.log(e); - generateNotify("Something went wrong!", "danger"); + preLoad(); + + function preLoad() { + var qualitySelected = @Model.QualityProfile; + if (!qualitySelected) { + return; } - }); + var $form = $("#mainForm"); + $.ajax({ + type: $form.prop("method"), + data: $form.serialize(), + url: "sonarrprofiles", + dataType: "json", + success: function(response) { + response.forEach(function(result) { + if (result.id == qualitySelected) { + + $("#select").append(""); + } else { + $("#select").append(""); + } + }); + }, + error: function(e) { + console.log(e); + generateNotify("Something went wrong!", "danger"); + } + }); + } - } + } $('#save').click(function(e) {