sends a POST AJAX request to the server
url | string | the URL to load |
params | object | the object with parameters to send to the server |
callback | function | optional callback function |
promise | "promise" of the object with the methods for getting data |
webix.ajax().post('data.php', { filter : '123' }).then(function(data){
// response
console.log(data.text());
});
The callback function receives 3 parameters:
The method returns a promise object than contains the eventual result of the AJAX request. A promise can be used instead of callbacks. The function inside the then() of a promise receives the result
parameter - the object that has the following methods:
webix.ajax().post('data.php', { filter : '123' }).then(function(result){
console.log(result.json());
}).fail(function(xhr){
var response = JSON.parse(xhr.response);
webix.message({type: 'error', text: response.error.message});
});
More information on Webix and Promiz.js usage can be found at: