I have a link and when user click on it, then he get a PDF. In jQuery, I create a POST ajax call to the server to get the PDF. The response is a PDF, with correct content headers etc that would normally cause the browser to open the Reader plugin, or allow the user to save the PDF. But in my case, this is not working. Is there any way to set data content type, or set content type to PDF?

My ajax call:

```
$('#sf_getpdf').click(function() {

 $.ajax({    //create an ajax request to load_page.php

        type: "POST",

        url: "index.php?route=sale/order/superfaktura_getpdf&token=<?php echo $token; ?>",

        data: 'invoice_id=<?php echo $invoice_id; ?>&sf_token=<?php echo $sf_token ?>',  //with the page number as a parameter

        dataType: "text",   //expect html to be returned

        success: function(msg){

            if(parseInt(msg)!=0)    //if no errors

            {

            document.write(msg)
            }

        }

    });

});

```

Firebug, response:
![Firebug](https://i.stack.imgur.com/HhhcV.png)

Response in browser...

![response in browser](https://i.stack.imgur.com/NGJ07.png)

I already tried to set content-type in server, without success:

![content-type in server](https://i.stack.imgur.com/oTw0S.png)

Edit: The Ajax is not needed, to do this. 

```
<a id="adr_stitok" target="_blank" href="index.php?route=sale/order/superfaktura_getpdf&token=<?php echo $token; ?>&invoice_id=<?php echo $invoice_id; ?>&sf_token=<?php echo $sf_token ?>" >Download</a></td>

```

Will do the thing.