• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

구름IDE에서 ajax통신을 할때 type이 POST는 안되는데 type이 GET이면 되는 이유가 궁금합니다.

19.12.22 20:01 작성 조회수 267

1

type을 POST를 설정했을때 아래와 같은 메세지가 콘솔창에 뜹니다.

"POST https://insta-clone-real-wqbff.run.goorm.io/insta_clone_real/data/like.json 405 (Method Not Allowed)"

구글링으로 원인을 찾아보았는데요

해당 페이지가 존재하는지 체크를 했는데 주소창에 json파일 페이지가 확인이 되어서

method가 일치하는지 한번 Jqeury를 찾아보았는데 jQuery.extend안에  JqeurySetting부분이 있더라고요

ajaxSettings: {

url: ajaxLocation,

type: "GET",

isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),

global: true,

processData: true,

async: true,

contentType: "application/x-www-form-urlencoded; charset=UTF-8",

/*

timeout: 0,

data: null,

dataType: null,

username: null,

password: null,

cache: null,

throws: false,

traditional: false,

headers: {},

*/

accepts: {

"*": allTypes,

text: "text/plain",

html: "text/html",

xml: "application/xml, text/xml",

json: "application/json, text/javascript"

},

contents: {

xml: /\bxml\b/,

html: /\bhtml/,

json: /\bjson\b/

},

responseFields: {

xml: "responseXML",

text: "responseText",

json: "responseJSON"

},

// Data converters

// Keys separate source (or catchall "*") and destination types with a single space

converters: {

// Convert anything to text

"* text": String,

// Text to html (true = no transformation)

"text html": true,

// Evaluate text as a json expression

"text json": jQuery.parseJSON,

// Parse text as xml

"text xml": jQuery.parseXML

},

// For options that shouldn't be deep extended:

// you can add your own custom options here if

// and when you create one that shouldn't be

// deep extended (see ajaxExtend)

flatOptions: {

url: true,

context: true

}

위 코드중 TYPE설정부분이 "GET"으로 되어있는데 혹시 이게 원인인건가요??

너무 죄송스럽지만 답답해서 질문 올립니다.

답변 2

·

답변을 작성해보세요.

0

김호중님의 프로필

김호중

질문자

2019.12.25

지금은 프로트단 HTML,CSS,JS 화면그리는 부분을 하고 있습니다.

링크입니다.

https://goor.me/uvZns

0

김호중님 안녕하세요 ^^ 

혹시 settings.py 파일에서 

ALLOWED_HOSTS = ['*']

위에 부분이 동일하게 되어 있을까요?

jquery 파일과는 관련이 없어보여요 ㅠ ㅠ

혹시 어느파트의 강의를 따라하고 계실까요? 구름컨테이너를 공유해주실수 있을까요? :) ajax가 원래오류가 많이 나요 너무 스트레스 받지 마시고 하나씩 해결해 보시죠 ㅎ