var apiurl = "/monitorapi?cmd=tenants";
$(document).ready(function() {
var preselectTenant;
var urlTenant = getUrlParameter("tenant");
var cookieTenant = getCookie("tenant");
if (typeof urlTenant !== 'undefined') {
preselectTenant = urlTenant;
} else {
preselectTenant = cookieTenant;
}
$.ajax({
url : apiurl,
type : "GET",
async : true,
dataType : "json",
success : function(response) {
$.each(response, function(index, tenant) {
// If we have no cookieTenant, look at default. Otherwise check if the key
// equals cookieTenant.
if (tenant === preselectTenant) {
$('#tenants').append($('