traccar attributes list code example
Example: traccar attributes list
function getCommandTypes(id) {
$.ajax({
type : "GET",
url : sessionStorage.getItem('url') + "commands/types/",
cache: false,
data:{deviceId:id},
contentType: "application/json",
headers: {
"Authorization": "Basic " + btoa(sessionStorage.getItem('email')+":"+sessionStorage.getItem('password')),
"Accept":"application/json"
},
error: function (response) {
switch(response.status) {
case 400:
doOpenAlertError($.i18n("message_user_not_permission"));
break;
case 401:
doOpenAlertError($.i18n("message_user_unauthorized"));
break;
case 404:
doOpenAlertError($.i18n("message_user_no_matching"));
break;
default:
doOpenAlertError($.i18n("message_error_performing"));
break;
}
},
success: function (response) {
limpaSelect("type");
$.each( response, function( key, value ) {
insertOption("type", value.type,$.i18n("title_" + value.type));
});
}
});
}