Jquery with post to open a pdf generated with aspx

Jquery with post to open a pdf generated with aspx

Hello,
I've got a Silverlight application, I call a javascript function defined as 

  1.           function test(dateStart,dateEnd,idGauge,description) {



  2.               $.post('content/ShowHistoricalReport.aspx', { dateStart: dateStart, dateEnd: dateEnd, selectedGauge: idGauge, description: description }, function (data) {
  3.                  
  4.                   var win = window.open('about:blank');
  5.                   with (win.document) {
  6.                       open();
  7.                       write(data);
  8.                       close();
  9.                   }
  10.               });
  11.     
  12.             };

This function will open a aspx page that will send back a pdf...

here's the intresting code

  1. if (buffer != null)
  2.                    {
  3.                       
  4.                        Response.ContentType = "application/pdf";
  5.                        Response.AddHeader("content-length", buffer.Length.ToString());
  6.                        Response.BinaryWrite(buffer);
  7.                        Response.Flush();
  8.                        Response.Close();
  9.                    }
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