+ 11
PHP file only for AJAX
Hi, Is there any way to declare that some PHP file is used only for AJAX and that it cannot be rendered in client browser when he types its URL?
1 ответ
+ 1
Not possible. There is no way to detect what sent the request to the server. However, you can send an extra field ajax=true with the request.
Then in your PHP
<?php
if(empty($_GET['ajax'])){
exit(0);
}
Note that this can not stop browser request that append ?ajax=true to the url