In my servlet, I use Jasper to generate a PDF report as follows:
        JasperRunManager.runReportToPdfStream(reportStream,servletOutputStream, parameters, conn);
        response.setContentType("application/pdf");
        servletOutputStream.flush();
        servletOutputStream.close();               
This is my AJAX call to generate the PDF. When the call to the service completes successfully and I attempt alert the data, it shows binary data that starts with "%PDF-1.4...".
        $.ajax({
            url : pdfURL,
            success : function(data) {
                alert(data); //contains "%PDF-1.4..."
                //How do I put this "data" into an <OBJECT>?
                //This code below is NOT working
                var obj = $('<object type="application/pdf" width="100%" height="100%" border="2"></object>'); 
                obj.attr('src',data);   
                $('#rptDiv').append(obj);
            }
        });
Now how do I put this PDF data into an OBJECT element and embed it to a DIV?
