Ruby on Rails Saturday, September 4, 2010

I think one of the things you might need is a 'timer', which will let
your code 'sleep' before calling again your 'how_finished' function. I
have never done this but remember reading about it, I googled for
'javascript sleep timer' and one of the links I found was this:
http://www.daniweb.com/forums/thread47199.html

In order to communicate with the server from Javascript I would look
into Prototype or jQuery. They simplify enormously the code in
Javascript to be able to communicate with your server using AJAX.

I hope this gets you started.

On Sep 3, 8:14 pm, "A. Leek" <li...@ruby-forum.com> wrote:
> Hello again,
>
> I've managed to hack together an uploader, but I need  a progress bar to
> go with it. I ended up using FTP to upload, and got a way to find the
> progress while it's uploading. I split that off into another function in
> the controller, which is all well and good.
>
> The problem is that I need to repeatedly call the how_finished function
> while the file is uploading. The form goes to the uploading function, so
> I need another way to repeatedly call how_finished. The best way seems
> to be with Javascript and AJAX, but I can't find a good way of setting
> up and calling a Javascript function to get the information from the
> controller. Looking at other Ruby progress bars
> (http://railsillustrated.com/screencast-file-uploads-progress-in-rails...)
> it seems to be possible to call the controller with Javascript, but that
> also requires a separate module for Apache that doesn't work for FTP
> uploads. I've been looking around at JSON, but I don't really understand
> it or how to use it to do what I want.
>
> I'm pretty sure I have all the information I need in the program, the
> problem is getting it all together and I'm not sure if that's even
> possible. Does anyone have ideas?
> --
> Posted viahttp://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment