I am sending an array in AJAX request:
$.ajax(
{
type: "POST",
url: "http://192.168.0.15/calc",
data: {
"phone": phone,
"points": [
{ "lat": 59.15234, "lon": 30.99 },
{ "lat": 59.15244, "lon": 30.99 },
{ "lat": 59.15254, "lon": 30.99 }
],
"start_at": 1407249093,
"certificate": "849840487484"
},
success: function(data) {
alert('success');
},
error: function(jqXHR, textStatus, errorThrown){
console.log(jqXHR.statusCode());
console.log(textStatus);
console.log(errorThrown);
}
}
);
Then inspect points:
params[:points].inspect
and see a hash:
{
"0"=>{"lat"=>"59.15234", "lon"=>"30.99"},
"1"=>{"lat"=>"59.15244", "lon"=>"30.99"},
"2"=>{"lat"=>"59.15254", "lon"=>"30.99"}
}
How to get an array instead of hash (preferably initially, without having to convert the hash to array)?