ruby on rails + ajax + iframe image uploader

you should use a plugin called responds_to_parent :
http://agilewebdevelopment.com/plugins/responds_to_parent