This is the situation: I have 2 files, reportCaller.php and report.php. From the reportCaller.php, the user is going to press a button with the method "onclick", this will call the function that is going to do the ajax/post stuff (this is with what im having problems), report.php is going to catch some parameters by POST and has to be opened on a new Tab or Window, this is going to display a report. (Note: May be not important, but im using HTML2PDF).
reportCaller (HTML):
<input type="button" onclick="generateReport()">
reportCaller (JS):
function generateReport(){
var id = '¡I must reach the report FILE!';
//I tried a couple stuff, but didnt work, this is one:
$.ajax({
type: "POST",
url: "report.php",
data: {id:id},
cache: false,
success: function (html) {
myWindow = window.open(encodeURIComponent(true),
"_blank");
myWindow.focus();
});
}
report:
$id = $_POST['id'];
//This file (report.php) must catch $_POST, will not help if i only open the file in a new Tab/Window
Thanks for reading.