jQuery 1.7.2를 사용 중이며 다른 도메인에 POST 요청을하고 싶습니다. POST 요청이어야합니다. 하지만 이것은 이 인터넷 익스플로러에서 작동하지 않습니다 (IE9에서 시도했습니다). 그것은 다른 모든 브라우저에서 작동합니다. 내가 다시 오류가인터넷 익스플로러에서 도메인 간 POST 요청 아약스
<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>
:
나는이 스크립트가
내 PHP 파일은 다음과 같습니다{"readyState":0,"status":0,"statusText":"Error: Access denied.\r\n"}
: 않습니다 (IE9 포함)
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS');
echo json_decode(array('success' => 'yes'));
가능한 중복 ([크로스 원산지 자원 공유를받는 방법 (CORS) 게시 요청이 작동] http://stackoverflow.com/questions/5750696/how-to-get-a-cross-origin -resource-sharing-cors-post-request-working) – Jon
관련 링크 : http://stackoverflow.com/a/12014195/545328 – 65Fbef05
중복 : http://stackoverflow.com/questions/13149122/jquery-ajax-cross- domain-form-submission-issues-with- – inf3rno