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

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -