Many people face problem when they try to use ajax in cross domain (i.e from any other website).
For example you have ajax script on www.example.com and it want to access test.php file on www.otherexample.com
You should include the below given headers on the top of test.php file
header(‘Access-Control-Allow-Origin: ‘.$_SERVER[‘HTTP_ORIGIN’]); header(‘Access-Control-Allow-Methods: POST, GET, OPTIONS’); header(‘Access-Control-Max-Age: 1000’); header(‘Access-Control-Allow-Headers: Content-Type’);
If it helps you please post thank you in comment 🙂