Rails 3 / Ajax - Turning link_to into a Jquery link?

$(function() { $("#picture a"). Live("click", function(event) { event.preventDefault(); // prevent the click from linking anywhere $. Ajax({ url:'/my_ajax_file.

Erb', dataType:'html', data: $(this). Attr('id'), // send whatever here... type: 'post', success:function(data){ $('#picture'). Html(data); } }); }); }).

Try $("#picture"). Html(""); but if you use prototype and jquery change $ for jQuery.noConflict() $(function() { $("#picture a"). Live("click", function() { $.

GetScript(this. Href); return false; }); }).

Thanks for the help (everyone). Working with this, I seem to be having successful ajax links, as my pagination links are no longer changing the URL and are working. The external links though do nothing, any ideas?

– Kombo Jul 26 at 20:44 I need to see your new code. – Norm212 Jul 28 at 15:44.

Don't forget to have in your controller something like: respond_to do |format| format. Html do redirect_to #whatever you normally redirect to for html end format. Js do render :json => some_json_thing #this will get passed back as the data element in the ajax callback above end end.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions