Initial commit for api.js

- GET JSON call with console output
- Provide filters
This commit is contained in:
Oliver committed 2018-05-04 23:43:41 +10:00
1 parent 2edb865528
commit 83dd068fec
2 files changed
+25

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
function inventreeGet(url, filters={}) {
$.ajax({
url: url,
type: 'get',
data: filters,
dataType: 'json',
success: function(response) {
console.log('Success GET data at ' + url);
return response;
},
error: function(xhr, ajaxOptions, thrownError) {
console.error('Error on GET at ' + url);
console.error(thrownError);
return {};
}
})
}
function getParts(filters={}) {
return inventreeGet('/api/part/', filters);
}