jquery - Open file in new window -
i have jquery function calls action getreport returns pdf file. action return file(renderedbytes, mimetype);
this function
function showreport() { var clinic = $("#selectedclinic").val(); var date = $("#selecteddate").val(); var url = "/reports/getreport"; $.get(url, { selectedclinic: clinic, selecteddate: date }, function (data) { $("#output").html(data); }); }
this result in the
div $("#output") %pdf-1.3 1 0 obj [/pdf /text /imageb /imagec /imagei] endobj 5 0 obj << /length 4660 /filter /flatedecode >> stream x ������wॳ ��k����8�zo�f剥�,9������d�w�К_���ʶ��t��*�������r��z���7k{`[tuٷm���{��ж����� ;��e=�g}7j��.n~��ގ0xy'o7���.n�[��w�d��q���1��u:����u��#�����n�v���t~���7ecwd��=fx��i�7�dj;�i��l���
i ideally open pdf file in new window or tab. might show file div $("#output")
real question how open in new window.
by way works
@html.actionlink("view in new tab","getreport","reports", new {selectedclinic = "galway" }, new { target="_blank" })
but cannot set selectedclinic parameter without doing post.
the selectedclinic should come dropdown.
thanks eamon
instead of ajax can use standard javascript window.open function.
here's more information this: http://www.w3schools.com/jsref/met_win_open.asp
Comments
Post a Comment