<a href = 'view.php?path=...very long path' target='_blank'>PREVIEW</a>
Is it possible the same but using $.post
, instead of url
?
Something like this:
index.js
var lpath = 'home/lorem ipsum/lorem lorem/target.html';
$.post('../view.php', {path: lpath});
window.open('../view.php', '_blank');
view.php
$cnt = file_get_contents($_POST['path']);
echo $cnt;
result on view.php:
Undefined index path
file_get_contents(): Filename cannot be empty
I hope you understand the idea:
send the path of
target.html
toview.php
using$.post
method (or any suitable, but not via address baron
view.php
get and echo the content oftarget.html
Any help?