I have a working AJAX request in my browser. Now I need to use GET request for my JSON data in TVML project. How it is better to do it?
I was trying XMLHttpRequest, but it doesn't work or maybe I did something wrong?
function performRequest(type, route, data) {
return $.ajax({
type: type,
dataType: 'json',
url: url + route,
data: data
});
}
function getChannels() {
log(' > get channels');
return performRequest('GET', 'channel/list', {
id: browserId
}).then(function (response) {
response.data.forEach(function (channel) {
channels[channel.id] = channel;
});
});
}