I'm using ajax to make a request for an img via an external url. Using return(url) gives me the result I'm looking for but when doing this through the promise I don't. When logging the url I get the image data. I'm not worried about CORS as the header has been allowed via the server.
getProductImg: function(id) {
var url = 'https://test' + id;
return(url); //This gives me the result I want, but I'm looking to do this through the request below.
$.get(url, function() {
console.log('request has been made');
}).done(function(url) {
console.log('url' + url);
return (url);
}).fail(function() {
alert( "error" );
}).always(function() {
console.log('something generic here');
});
}