I am now facing an issue related to getScript in rails. Actually I am able to pass a variable data to a particular action of my rails controller using the following line in my view.
getScript('/user/out_action.js?pt=' + resulted_time); // resulted_time is the variable name I want to send.
Where 'user' is the controller name and out_action is an action in the controller. It is completely fine.
Now my problem is that I am unable to send multiple different variable data to the controller action from my view. I am using ruby on rails. I want to pass this data using one single call.
For example I want to pass to another variable like resulted_time using the same call.
Please tell me how to do it.
Very simple you need to enhance your query string like below example. If you are using coffee script below
$.getScript('/user/out_action.js?pt=#{resulted_time}&ps=#{resulted_time}');
That will insert multiple parameters. For plain javascript, you can use below code.
$.getScript('/user/out_action.js?pt='+resulted_time+'&ps='+resulted_time);
Let me know if you need more elaboration.