$.search(boxes).then(function(results) {
…
}), function(error) {
…
};
That's a syntactical error - you want
$.search(boxes).then(function(results) {
…
}, function(error) {
…
});
return dfd.reject("failed").promise();
Is a stylistic issue - you cannot return
anything from the callback, and you don't need a .promise()
here. It might be better to write
dfd.reject("failed");
return;