I use the following on a webpage but cannot get a response from the server during processing
<script type="text/javascript"> </script> <% form_for( :fmfile, :url => '/fmfiles', :html => { :method => :post, :name => 'Form_Import', :enctype => 'multipart/form-data' } ) do |f| %> ... <%= f.file_field :document, :accept => 'text/xml', :name => 'fmfile_document' %> <%= submit_tag 'Import', :onClick => "setInterval('updateProgress()', 2000);" %>
The "create" method in fmfiles_controller.rb then successfully processes the file and receives the correct results (according to the submit button on the form). If I uncomment the line '// alert (' Hello '), I get a dialog saying Hello every 2 seconds ... as expected.
However, the server never registers a call to the progress_monitor method in the “files” of a failed attempt.
If I click the link
<a href="#" onclick="updateProgress();">Run</a>
it makes a call to the server, receives a response and displays a dialog, so I assume that the routes, syntax and naming are all right.
I really don't know why this is not working. Is it because 2 methods in one controller are called via URLs?
I am using Rails 2.1.0 in a development environment on OS X 10.5.5 and using Safari 3.1.2
(NB This follows from another question , but I think it is quite different from my own question.)
source share