mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-09-11 23:00:06 +02:00
fetchLabels with postUpdate callback
This commit is contained in:
parent
2ec941e1a0
commit
f048d0adb7
@ -163,5 +163,12 @@ $(function () {
|
||||
}
|
||||
);
|
||||
|
||||
$(document).ready(fetchLabels())
|
||||
$(document).ready(fetchLabels({
|
||||
postUpdate: function(data) {
|
||||
var labels = data.labels;
|
||||
for (var i = 0; i < labels.length; i++) {
|
||||
createLabelItem(labels[i])
|
||||
}
|
||||
}
|
||||
}))
|
||||
});
|
||||
|
@ -13,15 +13,14 @@ function createLabelItem(data) {
|
||||
|
||||
}
|
||||
|
||||
function fetchLabels() {
|
||||
function fetchLabels(options) {
|
||||
jQuery.ajax("c/restful/labels/", {
|
||||
async:false,
|
||||
dataType:'json',
|
||||
type:'GET',
|
||||
success:function (data) {
|
||||
var labels = data.labels;
|
||||
for (var i = 0; i < labels.length; i++) {
|
||||
createLabelItem(labels[i])
|
||||
if (options.postUpdate) {
|
||||
options.postUpdate(data)
|
||||
}
|
||||
},
|
||||
error:function (jqXHR, textStatus, errorThrown) {
|
||||
|
Loading…
Reference in New Issue
Block a user