2

This code,

$http.jsonp('http://localhost:3000/students?callback=JSON_CALLBACK',{
                data:student,
                method:'POST'
})

sends a GET request instead of a POST request. Rails log:

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)

How can I fix that?

Ben Aubin
  • 5,542
  • 2
  • 34
  • 54

1 Answers1

4

JSONP requests can only be GET requests. I'd have a look at this post detailing why this isn't possible.

Community
  • 1
  • 1