Have the following Ajax request:
data = {foo: {id: 1},
array: [
{id: 2, date: "Jan 1, 2015", quantity: 100}
]}
$.ajax "/api/foo",
type: "POST",
dataType: "JSON"
data: data,
success: (data) ->
console.log(data)
The issue is that the server gets the following params:
{foo: {id: 1},
array: {
0:{id: 2, date: "Jan 1, 2015", quantity: 100}
}}
As you can see the array is transformed into a hash with incremental keys. Why isn't the data being received as I sent it?