2
레일즈 3.2.6 및 JQuery 1.7.2에 난처한 문제가 있습니다.POST 요청이 GET으로 해석되는 이유는 무엇입니까?
나는 내 서버에 POST 요청을하려고했지만 어떤 이유로 내 로그에 GET 만 표시됩니다.
Started GET "/trials" for 127.0.0.1 at 2012-07-21 21:43:17 -0400
Processing by TrialsController#index as JSON
Trial Load (0.2ms) SELECT "trials".* FROM "trials"
Completed 200 OK in 88ms (Views: 2.7ms | ActiveRecord: 1.1ms)
내가 rake routes
을 확인하지만 명확하게 게시하는 것을 말한다 :
, 내 자바 스크립트 콘솔에서이를 입력 할 때 ...
$.ajax({
type: 'POST',
url: 'trials'
});
... 내 기록이 보여 하지 trials#index
, trials#create
로 이동해야합니다
trials GET /trials(.:format) trials#index
POST /trials(.:format) trials#create
new_trial GET /trials/new(.:format) trials#new
edit_trial GET /trials/:id/edit(.:format) trials#edit
trial GET /trials/:id(.:format) trials#show
PUT /trials/:id(.:format) trials#update
DELETE /trials/:id(.:format) trials#destroy
저는 웹 개발에 익숙하지 않으므로 ... 도와주세요!
여기 무슨 일 이니?
왜 내 POSTs
은 GETs
으로 변환 되나요?
글쎄, 귀하의 요청이'POST'로 만들어지고 있습니까? 브라우저 도구, Fiddler 또는 Wireshark로 확인하십시오. – Brad