Routing in Ajax petition in Rails 2 -
Routing in Ajax petition in Rails 2 -
i have next in view:
$('#anid tr').click(function () { $.ajax({ type: 'get', url: '/tickets/extended_info', datatype: 'script', data: { id: $(this).find('td:first').html() } }); }); and in tickets controller:
def extended_info(id) puts ">>>>>>>>>>>>>>> " + id.to_s end but 404 not found ajax request.
i think i'm missing in routes file... tried several things, nothing.
any ideas?
>>>>>>>>>>>>>>>>>>>>> resolved <<<<<<<<<<<<<<<<<<<<<<<<<
i had add:
map.extendedinfo '/extended_info/:id', :controller => 'tickets', :action => 'extended_info' to routes file.
also, using "get" in ajax phone call in javascript ... changed post , it's working =)
really seems routing trouble. have appropriate row /tickets/extended_info path in routes.rb? if so, can post here?
i suppose this
get "/ticket/extended_info", :to => "tickets_controller#extended_info" in routes.rb , action on controller should just
def extended_info puts params[:id].inspect end ruby-on-rails ajax routing
Comments
Post a Comment