I'm trying to send a request GETto my controller /routes/, so I can get some data back, right now I have
function fetchMarker(id) {
var data;
$.ajax({
type: "GET",
url: '/routes/',
data: id,
dataType: "JSON",
success: function(data) {
console.log(data)
}
});
}
But the problem is when I do this, Firebug tells me:
"NetworkError: 404 Not Found - http://10.0.0.24:3000/routes/?15"
I believe this is caused ?, I recently switched to Ruby on Rails, so I don’t know if this is normal, but the rake routes tell me that it should be / routes / (params [: id]), so I accept identification number only.
My controller:
def show
@route = Route.find(params[:id])
respond_to do |format|
format.html
format.json { render json: @route }
end
end
Thanks pending!
source
share