I think I'm either misunderstanding or missing something when it comes to Javascript callbacks.
$(document).ready(function () {
reload_Editables(loadTab());
}
function reload_Editables(callback) {
var xeditables = ["Description", "Type", "GTIN"];
$.each(xeditables, function (i, val) {
$("#" + val).editable({
inputclass: "form-control",
success: function (response, newValue) {
itemPageModel.set(val, newValue);
}
});
});
debugger;
callback();
}
function loadTab() {
if ($('#Type').text().toUpperCase() == 'TEST') {
$('#test-tab').show();
}
}
What I expected to have happen is loadTab to be passed into reload_Editables and only executed on callback. Instead loadTab is completing first (before even the first line of reload_Editables) and callback is undefined. What am I doing wrong?