게시 요청에서 405 (METHOD NOT ALLOWED)가 표시됩니다. jsonp는 GET 요청에 대해서만 작동하며, CORS를 사용해야 할 가능성이 가장 높습니다. 내 자바 스크립트 파일을 통해 CORS를 사용할 수있는 방법이 있습니까? 또는 별도의 서버 측 브리지를 만드는 것을 포함하지 않는 방법이 있습니까? 여기에 아약스 요청에 대한 코드는 다음과 같습니다405 jQuery()에서 오류 (메서드가 허용되지 않음) POST
function getData(){
var myUrl = 'http://text-processing.com/api/sentiment/';
var searchTerm = "happy";
$.ajax({
url: myUrl,
type: 'POST',
data: { 'text' : searchTerm },
dataType: 'jsonP',
error: function(msg) {
console.log(msg);
},
success: function(response){
console.log("it worked");
console.log(response);
}
});
}
getData();
CORS가 서버에서 활성화되어야합니다 ... 클라이언트 측에서 많은 일을 할 수 없습니다 .... http://stackoverflow.com/questions/3076414/ways-to-circumvent-the- 동일 출처 정책 –