Jquery with post to open a pdf generated with aspx
Hello,
I've got a Silverlight application, I call a javascript function defined as
- function test(dateStart,dateEnd,idGauge,description) {
- $.post('content/ShowHistoricalReport.aspx', { dateStart: dateStart, dateEnd: dateEnd, selectedGauge: idGauge, description: description }, function (data) {
-
- var win = window.open('about:blank');
- with (win.document) {
- open();
- write(data);
- close();
- }
- });
-
- };
This function will open a aspx page that will send back a pdf...
here's the intresting code
- if (buffer != null)
- {
-
- Response.ContentType = "application/pdf";
- Response.AddHeader("content-length", buffer.Length.ToString());
- Response.BinaryWrite(buffer);
- Response.Flush();
- Response.Close();
- }
The problem I've is that I receive a blank page with
%PDF-1.6 %�� 1 0 obj << /Creator(Telerik Reporting 6.2.13.110 \(
http://www.telerik.com/products/reporting.aspx\)) /CreationDate(D:20130218084652+01'00') /Producer(Telerik Reporting 6.2.13.110 \(
http://www.telerik.com/products/reporting.aspx\)) >> endobj 2 0 obj << /Pages 4 0 R /ViewerPreferences 3 0 R /Type/Catalog >> endobj 3 0 obj << /PrintScaling/None /Type/ViewerPreferences >> endobj 4 0 obj << /Kids[5 0 R] /Count 1 /Type/Pages >> endobj 5 0 obj << /Contents 6 0 R /Resources 7 0 R /MediaBox[0 0 841.89 595.276] /Group << /CS/DeviceRGB /Type/Group /S/Transparency >> /Type/Page /Parent 4 0 R >> endobj 6 0 obj << /Filter/FlateDecode /Length 744 >> stream X �V��}��=�Hi��ž� J��^��7�QHve��sΜq�geЬVb0_�dv��v� {��d#��&�o�������ۧK��I�gTԪx��O>�H6�P��yRK.����-���.�d}r�l2�xؗ�y��� ��������"U"�0���9" �_��Ʒf�C��VH! ۬��_2�����h�C��g 6~�/��憙A*s��������Py���;�����f�$K0ϴD������c��r�'o_C��Ǵ�l����*�����Bs��j)h��ڐES��K��ڒ���^�p�]�����Y���
And not the pdf.... what am doing wrong?
Thanks