I have this JS code. I need to pass the loadItemUrl value to the callback function off loadStruct method. The loadStruct is a function of a JS framework that we’re using.
In this example is the loadItemUrl value undefined in the inner scope of the callback function.
Form.prototype.Create = function (loadItemUrl) {
var dhxForm = new dhtmlXForm(this.divId);
dhxForm.loadStruct(this.url, function () {
if (loadItemUrl)
this.load(loadItemUrl);
});
}
If
loadItemUrlisundefinedthen it is because you aren’t passing a defined value toForm.Createwhen you call it.The callback function is defined in the scope of the Create function, so it will have access to any variables that exist there.