我对Rails 3.2.6和JQuery 1.7.2感到困惑。
我一直试图向我的服务器发出POST请求,但出于某种原因,只有GET出现在我的日志中。
例如,当我在我的Javascript控制台中输入它时...
$.ajax({
type: 'POST',
url: 'trials'
});
...我的日志显示:
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
,但它明确指出POST应该转到trials#create
,而不是trials#index
:
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
?
答案 0 :(得分:0)