I've been googling but I can't seem to get the right setup, through the things I've seen on google I ended up with this:
var dataString = $('#markerform').serialize();
var id = $('#route_id').val()
$.ajax({
type: 'POST',
url: '/routes/'+id,
data: { "_method":"put", dataString},
dataType: "JSON",
success: function(data) {
console.log(data);
}
});
And this for my routes controller
def update
@route = Route.find(params[:id])
respond_to do |format|
if @route.update_attributes
format.html
format.json { render text: "Done" }
else
format.json { render text: "Bad" }
end
end
end
But I end up with this firebug error:
SyntaxError: invalid object initializer
[Break On This Error]
data: { "_method":"put", dataString},
How might I clean this up so I can get some success going through this app. Thanks.