moved guild change bind to after guilds loaded
This commit is contained in:
parent
2978f99eeb
commit
4e92809b87
@ -320,10 +320,6 @@
|
||||
$(document).ready(function() {
|
||||
loadGuilds();
|
||||
loadSubscriptions();
|
||||
|
||||
$("#editSubServer").change(function() {
|
||||
loadChannels($(this).find("option:selected").attr("value"));
|
||||
});
|
||||
});
|
||||
|
||||
function loadGuilds() {
|
||||
@ -331,13 +327,19 @@
|
||||
url: "/guilds",
|
||||
type: "GET",
|
||||
success: function(response) {
|
||||
|
||||
// Add each guild as a selectable option
|
||||
for (i = 1; i < response.length; i++) {
|
||||
var guild = response[i];
|
||||
$("#editSubServer").append($("<option>", {
|
||||
value: guild.id,
|
||||
text: guild.name
|
||||
}));
|
||||
var option = $("<option>", {text: guild.name, value: guild.id})
|
||||
$("#editSubServer").append(option);
|
||||
}
|
||||
|
||||
// Bind the select to update channels on change
|
||||
$("#editSubServer").change(function() {
|
||||
var selectedGuildId = $(this).find("option:selected").attr("value");
|
||||
loadChannels(selectedGuildId);
|
||||
});
|
||||
},
|
||||
error: function(response) {
|
||||
console.error(JSON.stringify(response, null, 4));
|
||||
|
Loading…
x
Reference in New Issue
Block a user