I'm using jQuery 1.7.2 and would like to make a POST request to another domain. It must be a POST request. But this does not work in internet explorer (I tried on IE9); it works on all other browsers.
I have this script:
<script>
jQuery.support.cors = true;
jQuery(function() {
$.ajax({
crossDomain : true,
cache: false,
type: 'POST',
url: 'http://someotherdomain/test.php',
data: {},
success: function(da) {
console.log(JSON.stringify(da))
},
error: function(jqxhr) {
console.log('fail')
console.log(JSON.stringify(jqxhr))
},
dataType: 'json'
});
});
</script>
I get back the error:
{"readyState":0,"status":0,"statusText":"Error: Access denied.\r\n"}
My PHP file looks like this:
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS');
echo json_decode(array('success' => 'yes'));