I have a function in a class like this that returns a promise for deleting an item:
JavaScript
x
9
1
function Delete(){
2
// if(this.id == ""){
3
// return ?;
4
// }
5
return $.ajax({
6
ajax details
7
});
8
}
9
My question is, what do I return in order to ‘skip’ the ajax section which will validate to done so that I can do something like this (in another script):
JavaScript
1
4
1
$.when(Delete()).done(function(){
2
code to execute after item is deleted
3
});
4
Advertisement
Answer
Both of these seem work.
JavaScript
1
3
1
return $.when();
2
return true;
3
Thanks to the comments.