PHP cross-reference request with blocking
just wanted to find a solution to this. I am in system A and I make the following call
$("#page-form").submit(function(event){
$.ajax({
type: "POST",
url: "https://someOtherUrl/process.php",
data: {
'mobNumber': $("#mobile").val()
}
}).done(function (response) {
alert(response);
});
})
This now calls the PHP file on another server. This PHP file does nothing at the moment, I just
<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: PUT, GET, POST");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
var_dump("1");
However, I am getting an error with a cross-reference request. Why is this happening?
As a side note, I don't have access to the server that System A is running on, so this must be done on my server where the PHP file resides.
thank
Update
Server seems to have this Response Headers
Cache-Control no-cache
Connection Keep-Alive
Content-Type text/html; charset=utf-8
Date Thu, 25 Jun 2015 12:31:50 GMT
Expires Thu, 25 Jun 2015 12:31:50 GMT
Keep-Alive timeout=5, max=99
Pragma no-cache
Server Apache
Transfer-Encoding chunked
Vary Accept-Encoding
x-ua-compatible IE=edge
Request headers
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Connection keep-alive
User-Agent
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
+3
source to share
1 answer
Try this in the .htaccess file which is located in the root folder https: // someOtherUrl / :
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
0
source to share