재우니의 블로그



jquery 에서 ajax 함수에 put, delete 가 오래된 브라우저에서는 작동이 안된다는 말이 많네요.



사실 jQuery 문서를 보면,,, put, delete 가 모든 브라우저를 지원해 주지 않을 수 도 있다는 내용이 있죠.


https://learn.jquery.com/ajax/jquery-ajax-methods/#type



linktype

The type of the request, "POST" or "GET". Defaults to "GET". Other request types, such as "PUT" and "DELETE" can be used, but they may not be supported by all browsers.


그래서 나온게 꼼수가...



data: {'_method': 'delete'}


form 태그로 전송시에는 <input type="hidden" name="_method" value="DELETE">


이런식으로 _method 파라미터에 delete, put 을 넣고, ajax 은 post 로 넘기는 거죠.


이를 토대로, 쉽게 사용할 수 있도록 라이브러리가 있네요.