given some client side js
(function(){
var submitEmail = function () {
$("#join").click(function(e){
var email = $("#email").val()
if ( email.length === 0) { return false}
console.log(email)
$.ajax({
crossDomain: true,
type: "POST",
url: "https://www.rubyonrailstutor.com/join.json",
data: {first_name: "hacker", last_name: "github.io", email: "email" },
dataType: "JSON"
})
});
}
submitEmail()
given the following config in a rails application controller
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_headers
private
def set_headers
headers['Access-Control-Allow-Origin'] = 'http://rubyonrailstutor.github.io'
headers['Access-Control-Allow-Methods'] = 'POST'
headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match,Auth-User-Token'
headers['Access-Control-Expose-Headers'] = 'ETag'
end
end
getting the following behavior on heroku
2014-03-07T18:17:34.258456+00:00 app[web.1]: Started POST "/join.json" for 99.108.137.170 at 2014-03-07 18:17:34 +0000
2014-03-07T18:17:34.363521+00:00 heroku[router]: at=info method=POST path=/join.json host=www.rubyonrailstutor.com request_id=96ce40a0-652a-4d40-ab29-a364e47d4815 fwd="99.108.137.170" dyno=web.1 connect=3ms service=113ms status=200 bytes=897
2014-03-07T18:18:14.482579+00:00 app[web.1]: Started POST "/join.json" for 99.108.137.170 at 2014-03-07 18:18:14 +0000
2014-03-07T18:18:14.491328+00:00 heroku[router]: at=info method=POST path=/join.json host=www.rubyonrailstutor.com request_id=cdb3e5dd-b200-4aa4-9fd2-c97688f64f58 fwd="99.108.137.170" dyno=web.1 connect=2ms service=12ms status=200 bytes=897
2014-03-07T18:20:38.956777+00:00 app[web.1]: Started POST "/join.json" for 99.108.137.170 at 2014-03-07 18:20:38 +0000
it seems like not enough data is being passed to the server, ie, there are data params and the server doesn't appear to be processing anything, the request is being made and then I can't tell what is happening, what should I be digging into to fix this ?
THanks !