I am submitting a form like so:
formdata = $("#app_form").serialize()
formdata['apps'] = apps
hash = { type: "POST", url: "create_all", data: formdata }
$.ajax(hash)
The formdata posts, but the line:
formdata['apps'] = apps
is completely ignored. I can’t understand how Coffeescript and Javascript can just ignore a line completely. Very interesting.
The apps hash has the following structure:
{ "a" => { "1", "2", "3" },
"b" => { "4", "5", "6" },
...
"n" => { "x", "y", "z" } }
If:
formdata['apps'] = apps
doesn’t work after doing:
formdata = $("#app_form").serialize()
then how can I add the apps hash to the formdata hash prior to submission?
.serialize()returns a query string not an object, so to add a argument to the query string use string concatenationassuming apps is a string.