I have made an ajax post request for json data and I want to access that data in the rails controller so how can I access the data.
Here is how I posted the data using ajax
jQuery.ajax({
url: 'main/getlocation',
data: "{latitude:" + latitude + ",longitude:" + longitude + "}",
dataType: 'json',
type: "POST",
success: function(data) {
alert("Successful");
},
failure: function() {
alert("Unsuccessful");
}
});
How can I access the latitude and longitude data from the rails controller. I cannot access the data using the normal params[:latitude] and params[:longitude]. What should I use?