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?

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.