1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-11-13 21:52:29 +01:00
polr/public/js/api.js

27 lines
550 B
JavaScript

function apiCall(path, data, callback, fail_callback) {
var base_api_path = BASE_API_PATH;
var api_path = base_api_path + path;
$.ajax({
url: api_path,
data: data,
method: 'POST',
}).done(function(res) {
if (callback) {
callback(res);
}
}).fail(function (err) {
if (fail_callback) {
fail_callback(err);
}
});
}
function res_value_to_text(res_val) {
if (res_val == 1) {
return 'True';
}
else {
return 'False';
}
}