Well, AFAIK It HAS to be triggered by a click event on a A anchor, so, just make sure your onclick handler returns true.
For the "force download" functionality, this writeup of mine might help you: http://www.pixeline.be/blog/2009/php-force-download-script-convert-url-to-localpath/ On Thu, Jan 22, 2009 at 2:30 AM, MorningZ <morni...@gmail.com> wrote: > > You don't want AJAX in this situation.... have the page post like > normal and do what you lay out above... AJAX is *not* the solution to > every problem > > On Jan 21, 6:46 pm, AlexDeLarge <perkeleenperkelesaat...@gmail.com> > wrote: >> Hi, >> >> I have situation like this: I post certain data with $.post to PHP- >> script which is supposed to handle the data, create a file from it and >> then trigger browser to open a Save As-dialog. Everything works just >> fine except the Save As-dialog, I just can't make it pop-up. >> >> For the Save As dialog the PHP-script ha s following statements: >> >> header('Content-disposition: attachment; filename=stats.txt'); >> header('Content-type: text/plain'); >> readfile('stats.txt'); >> >> And this just doesn't work through $.post, or at least I can't make it >> happen. >> >> Is there any way to make this work?