Level 74
Using ajax to download a file seems a bit strange to me, however it seems that someone managed here
https://www.codeproject.com/Articles/5308865/Download-File-via-Ajax
Summer Sale! All accounts are 50% off this week.
I'm attempting to have laravel download a file during an ajax call. Everything is running smoothly with no errors, however no file is downloaded on the user's side. The check on the if statement is returning as true, so the file is there.
$file = 'json/fs_'.strtolower($entry->country).'.json';
if(Storage::disk('public')->exists($file)){
Storage::disk('public')->delete($file);
Storage::disk('public')->put($file, json_encode($entry));
}
}
Storage::disk('public')->download($file);
return response()->json(['success' => $country]);
Please or to participate in this conversation.