Angular JS `$http` 发送 POST 而不是 GET
Angular JS `$http` sends POST instead of GET
这段代码,
$http.jsonp('http://localhost:3000/students?callback=JSON_CALLBACK',{
data:student,
method:'POST'
})
发送 GET 请求而不是 POST 请求。
Rails日志:
Started GET "/students?callback=angular.callbacks._1" for ::1 at 2015-03-28
20:07:30 -0500
Processing by StudentsController#index as */*
Parameters: {"callback"=>"angular.callbacks._1"}
Student Load (0.5ms) SELECT `students`.* FROM `students`
Rendered students/index.jpbuilder (2.4ms)
Completed 200 OK in 7ms (Views: 5.9ms | ActiveRecord: 0.5ms)
我该如何解决?
JSONP
个请求只能是 GET
个请求。我会看看 this post 详细说明为什么这是不可能的。
这段代码,
$http.jsonp('http://localhost:3000/students?callback=JSON_CALLBACK',{
data:student,
method:'POST'
})
发送 GET 请求而不是 POST 请求。 Rails日志:
Started GET "/students?callback=angular.callbacks._1" for ::1 at 2015-03-28
20:07:30 -0500
Processing by StudentsController#index as */*
Parameters: {"callback"=>"angular.callbacks._1"}
Student Load (0.5ms) SELECT `students`.* FROM `students`
Rendered students/index.jpbuilder (2.4ms)
Completed 200 OK in 7ms (Views: 5.9ms | ActiveRecord: 0.5ms)
我该如何解决?
JSONP
个请求只能是 GET
个请求。我会看看 this post 详细说明为什么这是不可能的。