I have this ajax call and I need to turn it into a promise.
function myRest(url, method, callback){
return $.ajax({
url : url,
type : method,
dataType: "json",
contentType: "application/json",
success: function(results){
//things to do in case of success
},
error: function (){
//things to do in case of error
}
});
}
How could I also use the .then() method in case of success? Thanks