Reputation: 2867
I have this code and it won't work unless I pass a constant to data. What am I doing wrong?
function onMapClick(e) {
$.ajax({
url: "/temps",
type: "POST",
data: {coordinates: e.latlng},
success: function(response) {
// map.openPopup("hello", e.latlon);
alert(e.latlng.lat);
// return response;
}
});
};
Upvotes: 0
Views: 112
Reputation: 2761
Try using toJSON to turn the data into a json string, then when you receive it in your ruby code you can use JSON.parse(data)
Upvotes: 2