开发者

Rails AJAX Image Swap

I'm trying to make an AJAX call in Rails to swap images on a page. The page has a big div that is initially blank, along wit开发者_运维问答h a table with several entries. One of the columns in this table contains the path for an image, and what I am trying to do is on user click, swap this image into the div.

I was hoping to have a controller variable hold the path to the current image, and on user click store the new value into the variable, and I guess in the view somehow retrieve this value in an image_tag, but I haven't gotten it to work.

I haven't found any guides on how to do this, any ideas? I'm using prototype because Rails seems to prefer it, which doesn't work well for me because I come from a jQuery background...


this is a working example http://jsfiddle.net/S44dC/


Remotipart is the easiest way to make exiting remote form enable for image upload

https://github.com/JangoSteve/remotipart

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜