Format javascript variable to be used by Rails -
i sending post request rails server.
the server executing code :
list.create!(params[:list]) here javascript (coffeescript) call :
createlist: (list) -> $$.post 'http://localhost:3000/lists.json', data, null, 'json' i trying pass data formatted in way rails able read it. tried creating var params = { "list":list }, error
nomethoderror (undefined method `stringify_keys' "[object object]":string) how can correctly format data passed rails?
createlist: (list) -> $$.post 'http://localhost:3000/lists.json', json.stringify(data), null, 'json'
Comments
Post a Comment