Everything works like I want it to, except I get this weird error text that is inserted into the page (but not the html). Here is my controller:
def search if request.xhr? if params[:search_text].strip.length > 0 terms = params[:search_text] @results = User.find( :all, :conditions => [ 'LOWER(first_name) LIKE ? OR LOWER(last_name) LIKE ?', "%#{terms.downcase}%", "%#{terms.downcase}%" ], :limit => 10) render :update do |page| page[:results].replace_html :partial => "search" page[:recent].hide end elsif params[:search_text].strip.length == 0 render :update do |page| page[:recent].show end end else redirect_to users_path end end
Here is the error: try { $("recent").show(); } catch (e) { alert('RJS error:\n\n' + e.toString()); alert('$(\"recent\").show();'); throw e }
I'm guessing I'm screwing up the rjs code. When the live search input field is in use, I want to hide the 'recent' div. When it is Not in use, I want to show the 'recent' div. The error text ends up above the 'recent' div. Am I doing this the wrong way?