# Funky RJS error - Live Search

**URL:** <https://www.ruby-forum.com/t/funky-rjs-error-live-search/88884>\
**Category:** Rails\
**Created:** [March 15, 2007, 9:28am UTC](https://www.ruby-forum.com/t/funky-rjs-error-live-search/88884 "2007-03-15T09:28:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [March 15, 2007, 9:28am UTC](https://www.ruby-forum.com/t/funky-rjs-error-live-search/88884/1 "2007-03-15T09:28:30Z")

</div>

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?
