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

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -