I would like to perform an ajax request by passing some data from the browser (some text values as a string) and render view of the same action to which I am sending request using ajax.
My workflow goes like this:
User upload two files :calib and :inten.
app saves the file using paperclip and parses the information in different instance variables.
- Once the file is parsed app delivers the message in the form of
flash[:notice]
in create action and immediately make pr list available to the user as a drop down list in the browser. There are two partials
_form
and_formTwo
which gets rendered in create action.when I perform ajax request, I am in create view, and I am requesting other action named
norm
in the controller.- After the ajax call I want app to render the
norm.html.erb
without refreshing the page.
My codes are here: http://pastie.org/private/keykmwbzcrv04dfvkufsew
I tried ajax using unobtrusive javascript but I dont know how to pass some data (mentioned above) using link_to or button_to helper.
With simple jquery ajax, I can pass data to the server but my page is not rendering. Development log shows that Page is rendered, but nothing changes in the browser page. I know I am missing something but unable to figure it out??
Development log output:
Started POST "/normalize" for 127.0.0.1 at 2014-04-30 13:38:43 +0200
Processing by UploadsController#normalize as */*
Parameters: {"data"=>"17,Poly-T-CY5,EukS_1209_25_dT"}
Upload Load (0.1ms) SELECT `uploads`.* FROM `uploads` WHERE `uploads`.`id` = 17 LIMIT 1
Rendered uploads/_normalize.html.erb (0.2ms)
Rendered uploads/normalize.js.erb (1.0ms)
Completed 200 OK in 4ms (Views: 2.1ms | ActiveRecord: 0.1ms)
I hope I have explained my problem well, please let me know if I have not made myself clear??