I'm using jquery right now to dynamically add in links to download pdf files. I need a way to tell the browser to automatically prompt the user to download or open these pdfs instead of viewing them directly in the browser. Here is how I'm doing the jquery..
$listItem.each(function(){
var $itemUrl = $(this).attr('data-url');
$(this).prepend('<span class="drawer"><a class="download" href="pdfs/' + $itemUrl + '"><div class="drawer-download"></div></a><div class="drawer-print"></div><div class="drawer-smart-board"></div><div class="drawer-view"></div></span>');
});
And I'm assuming I need to use PHP do do this but I'm not quite sure how to go about writing the script since I don't want it to prompt the user to download every file just ones that are in that class of "download"
I have seen this question which is similar PHP Force File Download
but mine differs in that I can't add in a static file path, the path to the file will be different with each item. So it needs to be dynamic