I want to upload an image and show it without refresh.
The method I know is to use an hidden iframe and set the target of the form to it.
Then return a piece of javascript from controller calling “parent.func()” to do something…
But here is my problem:
It seems that the javascript will not be executed unless the foreground knows the dataType is “script”, something like:
$.ajax {
dataType:"script"
}
but when submit the form, I have to use
$("...").submit()
So I cannot specify the dataType….
Can anyone tell me what to do?…
Or can you tell me another way to achieve my goal:
upload a image and show it without refresh in Rails 3.2.0..
try to use remotipart gem:
http://github.com/JangoSteve/remotipart