I try to access my php file with javascript but it isn't work. I've protected my file with this block of code to prevent user direct access from a browser, it prevents script access as well:
Code:
$URL = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$slice = explode('/', $URL);
if ($slice[2] == "customer_info.php") {
	die("sry, no acces rights");
}
The file contains sensitive JSON data so it can be viewable on a browser.

Thank you,