ajax - CORS header 'Access-Control-Allow-Origin' missing in php -
this question has answer here:
in web application, try pass data domain ajax call. shows error cross-origin request blocked: same origin policy disallows reading remote resource @ http://example.com/auth/webschool/test.php. (reason: cors header 'access-control-allow-origin' missing).
my ajax code is,
$.ajax({ type: "post", url: "http://example.com/auth/webschool/test.php", data: {username: "abcd",password:"abcd"}, datatype: "html", success: function (data) { alert(data); } });
just put line on test.php, hopes work
<?php header('access-control-allow-origin: *'); ?>
Comments
Post a Comment