i am trying to pass JavaScript file variable to php to open the file in new window, but it seems, it is not working accurately
JavaScript code
function Open(){
var file = prompt("Enter a File name to open with .txt");
$.get( "php/OpenFile.php",
file,
function(result){
console.log(result);
}
);
}
PHP Code
<html>
<body>
<?php
$file = $_GET['file'];
$file2 = file_get_contents($file);
echo "<script type='text/javascript'>window.open($file2)</script>";
?>
</body>
</html>