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

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -