Reputation: 4962
I am able to get the output of a pdf using fpdf, the problem is that i am not to generate it if the call the function through jquery... rather the pdf is display in firebug?How to solve this issue
output display in firebug
%PDF-1.3
3 0 obj
<</Type /Page
/Parent 1 0 R
/Resources 2 0 R
/Contents 4 0 R>>
endobj
4 0 obj
<</Filter /FlateDecode /Length 582>>
stream
x���Ms�0���{LU���͞&�v�L�p��b��N��`Zc���k,ij��Bgh��b���{�|�����șP`�f�B���sS��C���*+�[H��K�ŁO��מ�����M:<�3�jt�:Z��1,�`�ˤc
�Ҁ�� ��0���~��^��U� �;�q�_6y
y�� ��+Q�6��e/���C%�ً+�!q5+�Sf
jquery:
$.post(url+"/create_pdf",js,function(data){
},"json");
Upvotes: 0
Views: 973
Reputation: 17710
Instread of $.post() (which will run the PDF gnerator and return contents to AJAX), you should redirect the user to the url in the browser: i.e. use
window.location.href=url+"registration/create_member?" + $.param(js);
You will need to convert your PDF generating function to accept $_GET, not $_POST
Alternatively, generate the pdf file as you are doing but store on server (temporarily) and pass the url back through ajax, Then ajax redirects the user to that temporary file location through windows.location.href instead.
Upvotes: 1