I am working on a website where the visitor should be able to download a pdf file. (There are three links to choose from but that is irrelevant) I wanted to know how to mak
The following code may help you:
Save this code as a php file (say, download.php) and call it from the link. What the script does is that it reads the pdf file and outputs it to the buffer. The headers will force the disposition as download.
To call the first pdf, href to '/path/to/download.php?docid=1'
To call the second pdf, href to '/path/to/download.php?docid=2'
To call the third pdf, href to '/path/to/download.php?docid=3'
So, you don't need AJAX to do the work.