Permission for PHP file using AJAX

Asked

Viewed 41 times

-4

I have a system that makes POST requests for. php files on the server by AJAX and they return me database data to work on JS. All. php files are in the same folder on the server.

I would like to know the best level of permission I should set to the folder/files aiming to allow the request only by AJAX, if possible, or as close to that.

1 answer

0

I usually use this header to give permission when I need to access by ajax, in the case of * you can set the source you want

header('Access-Control-Allow-Origin: *');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.