How do I pass a JavaScript variable to a Rails controller?
I am having a lot of trouble passing a JavaScript variable to my Rails controller. I know I have to do some kind of AJAX request, but everything I have tried (including this) have helped me understand what I am trying to do, but have not quite solved my problem. So, I figured I'd spill everything I was trying to do and get the expert community at StackOverflow to help.
I am trying to implement a search in my Rails app using SmartTextBox. The jQuery plugin can return the items in the form as a string, separated by a character of your choice (in my case, I am using '|'). I am trying to pass this string to my Rails controller so that it can parse the information and search our database. I have the Search function down, I just need to be able to pass it t开发者_开发百科he string from the SmartTextBox!
I have tried using <%link_to , $.get(), and several other methods without much luck. Does anyone have any experience with something like this, or have a suggestion on how to solve my problem? Thanks a lot!
精彩评论