In my $.ajax() from my JQuery script written inline in my blade.php view file, I have received a path to an image file (relative to public folder, like /thumbnails/87991.png) as a response. Say the response in success() of $.ajax() is stored in variable dataReturned.
console.log('dataReturned:'+dataReturned);
// Prints the correct '/thumbnails/87991.png'
So in the success() of $.ajax(), I want to set that path as the value of a src attribute for an <img> on that page. For that, I want to generate a valid URL by passing it to the Laravel's url() helper. Like as follows.
var thumbnailPhotoPathOnServer = "{{url(dataReturned)}}"; 
var thumbnailPhotoPathOnServer = "{{url('dataReturned')}}"; // I know it makes it a string but i still tried it out of desperation =(
var thumbnailPhotoPathOnServer = "@php echo url(dataReturned); @endphp";
I have tried all these statements but I keep getting
Use of undefined constant dataReturned - assumed 'dataReturned' (this will throw an Error in a future version of PHP)
So that question is that what am I missing here and what should I do about it?
