Help with webix.ajax()

Can anyone tell me what is wrong with this code? When it runs, I get this error “Uncaught TypeError: webix.ajax(…).headers(…).get(…).sync is not a function.” If i remove .sync(), then it runs fine.

function getApplicationData(appId) {
url = “/apiv1/api.php/records/ent_appconfig?filter=id,eq,” + appId;
webix.ajax().headers({
“<?php echo $api_header_key?>”:"<?php echo $api_header_value?>",
“Access-Control-Allow-Origin”:"*"
}).get(url).sync().then(function(data){
app_data = JSON.parse(data.text());
console.log(app_data.data);
});
}

Hi @dmcconnell68 ,

The error occurs because you use a sync mode.
By default requests are performed in the asynchronous mode and return a promise.
The sync method forces any request to run in a synchronous way. It returns an XMLHttpRequest object, so you can’t use promise methods in that case.