I have a link that when i click on it will trigger an ajax call then replace this link by another link, says for example the original link is \"add friend\", when i click th
Try this in your action.js.erb:
action.js.erb
setTimeout(function () { ("#link_for_friend").html("<%= escape_javascript(render('users/cancel_link')) %>") });
This will put the html replacement to the next timer tick that happens after the ajax:* events being triggered.
ajax:*