I have created a view model that handles a button click. in that click it calls ajax. if the ajax call is successfull, i want to hide a div and show another one. inside of the ajax callback, i cannot use this to reference the view model. I know i can call the view model by name, but should I?
what is the proper way to code the below snippet?
var viewModel = new kendo.observable({
visibleEntry: true,
visibleSuccess: false,
hideEntry: function(e) {
$.ajax('someurl').success(function(e) {
this.set("visibleEntry", false);
this.set("visibleSuccess", true);
});
}
});
kendo.bind($('#divContainer'), viewModel);​
what is the proper way to code the below snippet?
visibleEntry: true,
visibleSuccess: false,
hideEntry: function(e) {
$.ajax('someurl').success(function(e) {
this.set("visibleEntry", false);
this.set("visibleSuccess", true);
});
}
});
kendo.bind($('#divContainer'), viewModel);​