jquery - post data to new tab via ajax -
here try achieve: let's have 2 files, order.php , print.php. in order.php there button printing data. when user clicks button want post data order.php print.php. easy. how?
this last attempt this.
$.ajax({ type: 'post', url: '../event/print', async: false, data: {json:$("input[name=json]").val(),id:"2"}, success:function(data){ mywindow = window.open('../event/print', "_blank"); mywindow.focus(); }, error:function(data){ swal("oops...", "something went wrong.", "error"); }
it shows me error alert everytime 500 internal server error. i'm doing wrong?
edit i've changed things around web, , not show error. cant see $_post parameters.
in way calling page ../event/print twice.
the first time post request via ajax, second time request due fact opening new tab.
what describing not ajax request, form target="_blank".
http://www.w3schools.com/tags/att_form_target.asp
<form action="../event/print" method="post" target="_blank"> ...
Comments
Post a Comment