rails add object in javascript url -
i utilize function on js file , works
$(function() { $("#badgebutton").click(function() { var assertions = [ "http://www.exemple.com/patents/5555/badge.json" ]; openbadges.issue(assertions, function(errors, successes) { console.log("callback called"); console.log("errors:", errors); console.log("successes:", successes); }); }); });
in place of number :
"http://www.exemple.com/patents/5555/badge.json"
i utilize patent.id. tried :
"http://www.exemple.com/patents/#{@patent.id}/badge.json"
and other solution without success..
try doing this:
"http://www.exemple.com/patents/<%= @patent.id %>/badge.json"
but, it's advisable utilize routing helper methods generated rails when define them in routes.rb file. example:
<%= badge_patents_path(@patent, :format => :json) %>
javascript ruby-on-rails ruby-on-rails-3
No comments:
Post a Comment