I current add a form to the page, which is then submitted and returns
binary content (e.g. a PDF or Word/RTF Document) that causes a prompt
for them to open/download the file:

        var form = $(document.createElement("form")).attr(
        {
                "method": "post",
                "action": "getdocument.ashx"
        }).html("<input type='hidden' name='RecordID' value='1'>");
        $("body").append(form);
        form[0].submit();

The getdocument.ashx returns the following headers to cause the
download dialog to appear:

"content-type" = "application/rtf"
"content-disposition" = "attachment; filename=Record1.rtf"

Is there a way to use jQuery.post instead, I have tried the following,
to no avail (I can see the response in Firebug, so the file is
downloaded, but the user can't download it):

$.post("getdocument.ashx", { "RecordID": "1" } );

Thanks,
--Sam

Reply via email to