1

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 the 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!

2
  • These 2 blog posts will teach you everything you need to know alfajango.com/blog/rails-3-remote-links-and-forms Commented Jul 12, 2011 at 2:52
  • I am sort of confused...I don't have a rails forms right now, but I am trying to pass the JavaScript variable to the controller...I've looked at this post several times and can't figure it out :( Commented Jul 19, 2011 at 0:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.