title: jQuery.post returns 400 bad request error [rails]
body: <p>I am using rails 4 and balanced.js and am trying to post the returned token to the back end using jQuery.post. I have the correct url getting passed but receive a 400 error. TO CLARIFY: I am getting an error on the jquery.ajax after receiving a valid token from balanced.</p>
  
  <pre><code>jQuery -&gt;
  $('#cc-submit').click (e) -&gt;
      e.preventDefault()
  
      handleResponse = (response) -&gt;
          if (response.status_code == 201)
  
              fundingInstrument = (if response.cards? then response.cards[0] else response.bank_accounts[0])
  
              alert(fundingInstrument.href)
  
              $('#tablecharge_uri').val(fundingInstrument.href)
  
              url = '/events/' + urlid + '/tablecharges'
  
              alert(url)
  
              jQuery.ajax({type: "POST", url: url, data: {uri: fundingInstrument.href, event_id: urlid}, sucess: (data) -&gt;
                  alert data.id
              error: (data) -&gt;
                  alert "not cool"})
  
          else
              alert(response.status + JSON.stringify(response, false, 1))
  
      payload = {
      name: $('#cc-name').val()
      number: $('#cc-number').val()
      expiration_month: $('#cc-expiration-month').val()
      expiration_year: $('#cc-expiration-year').val()
      ccv: $('#cc-ccv').val()
      }
  
      balanced.card.create(payload, handleResponse)
  </code></pre>
  
  <p>here is my controller: </p>
  
  <pre><code>class TablechargesController &lt; ApplicationController
  def new
      @event = Event.find(params[:event_id])
      @table = @event.tablecharges.build
  end
  
  def index
      @event = Event.find(params[:event_id])
      @table = @event.tablecharges.all
  end
  
  def create
      @event = Event.find(params[:event_id])
      @table = @event.tablecharges.build(table_charge_params)
      respond_to do |format|
          format.js { render json: 'Your message', status: :ok } 
      end
      if @table.save
          redirect_to @event, :notice =&gt; "Thanks for the cash"
      else
          render :new
      end
  end
  
  private
  
  def table_charge_params
      params.require(:tablecharge).permit(:name, :email)
  end
  </code></pre>
  
  <p>end</p>
  
  <p>here is my model:</p>
  
  <pre><code>class Tablecharge &lt; ActiveRecord::Base
  belongs_to :event
  attr_accessor :cc_name
  attr_accessor :cc_number
  attr_accessor :cc_expiration_month
  attr_accessor :cc_expiration_year
  attr_accessor :cc_ccv
  end
  </code></pre>
  
  <p>UPDATE:
  here is the full error code from the chrome debugger:</p>
  
  <pre><code>POST "/events/7/tablecharges" 400 (Bad Request) 
  jquery.js?body=1:9632
  send jquery.js?body=1:9632
  jQuery.extend.ajax jquery.js?body=1:9177
  handleResponse tablecharges.js?body=1:13
  ret balanced.js:433
  window.(anonymous function) balanced.js:395
  (anonymous function)
  </code></pre>
  
  <p>UPDATE 2:
  here is the error from rails server</p>
  
  <pre><code> ActionController::ParameterMissing - param is missing or the value is empty
   actionpack (4.1.4) lib/action_controller/metal/strong_parameters.rb:183:in `require'
  </code></pre>