Hello, I just switched to using Passenger from using Apache/Mongrel cluster. I have an AJAX form: -------------------------------- <% form_remote_tag :url => {:controller => "networks", :action => ''search''}, :update => ''searchResults'', :loading => "Element.hide(''goBtn''); Element.show(''fts-loader'')", :complete => "Element.show(''goBtn'');Element.hide(''fts-loader''); " do %> <table border="0" bgcolor="#E5E5E5" cellpadding="0"> <tr> <td><span class="headerTextGreen">Search </span></td> <td><%= text_field_tag ''search_phrase'', '''', :size => ''20'', :class=>''search-box'' %></td> <td width="20"> <%= image_submit_tag ''btnGo.gif'', :id => ''goBtn'', :class => ''btnSearch'' %> <%= image_tag ''searchWait.gif'', :id => ''fts-loader1'', :style => ''display:none'', :size => "15x14" %> </td> </tr> </table> <% end %> ------------------------------- This form takes search string and then displays search results in div inside the page ,searchResults, and this was working fine with Apache/Mongrel. After using Passenger it still works but instead of displaying search results in the "searchResults" div, it refreshes the whole page with the search results as the div is the only page that the page has. Any ideas? Thanks, Tam -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
what''s in the source of generated page? c&p form code Tam Kbe wrote:> Hello, > > I just switched to using Passenger from using Apache/Mongrel cluster. > > I have an AJAX form: > -------------------------------- > <% form_remote_tag :url => {:controller => "networks", :action => > ''search''}, > :update => ''searchResults'', > :loading => "Element.hide(''goBtn''); > Element.show(''fts-loader'')", > :complete => > "Element.show(''goBtn'');Element.hide(''fts-loader''); " do %> > > <table border="0" bgcolor="#E5E5E5" cellpadding="0"> > <tr> > <td><span > class="headerTextGreen">Search </span></td> > <td><%= text_field_tag ''search_phrase'', '''', :size => > ''20'', :class=>''search-box'' %></td> > <td width="20"> > <%= image_submit_tag ''btnGo.gif'', :id => ''goBtn'', > :class => ''btnSearch'' %> > <%= image_tag ''searchWait.gif'', :id => > ''fts-loader1'', :style => ''display:none'', :size => "15x14" %> > </td> > </tr> > </table> > <% end %> > ------------------------------- > This form takes search string and then displays search results in div > inside the page ,searchResults, and this was working fine with > Apache/Mongrel. > > After using Passenger it still works but instead of displaying search > results in the "searchResults" div, it refreshes the whole page with the > search results as the div is the only page that the page has. > > Any ideas? > > Thanks, > > Tam-- ==============================================================================Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz ============================================================================== --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Tom: Here is the Ruby code --------------------- def search @page = params[:page] @page ||= 1; @search_phrase = params[:search_phrase] @search_phrase ||= '''' @users = User.search(@search_phrase, :sphinx => {:limit => $NUM_USER_SEARCH_RSLTS, :page => @page,:weights => [100,60,20,20]}, :per_page => $NUM_USER_SEARCH_RSLTS, :page => @page) @userColleagues = User.find_by_id(session[:user_id]).colleagues(:all, :conditions => ["networks.mutual = ?" , true]) @is_network_owner = false @is_network_owner = true if params[:id].to_i==session[:user_id] render :partial => ''user_search_results'', :locals => {:users => @users, :@userColleagues => @userColleagues, :@is_network_owner => @is_network_owner} end ---------------- Thanks, Tam -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Tam.. I meant html source of generated page with the form... tom Tam Kbe wrote:> Thanks Tom: Here is the Ruby code > > --------------------- > def search > @page = params[:page] > @page ||= 1; > @search_phrase = params[:search_phrase] > @search_phrase ||= '''' > > @users = User.search(@search_phrase, > :sphinx => {:limit => $NUM_USER_SEARCH_RSLTS, :page => > @page,:weights => [100,60,20,20]}, > :per_page => $NUM_USER_SEARCH_RSLTS, :page => @page) > @userColleagues = > User.find_by_id(session[:user_id]).colleagues(:all, :conditions => > ["networks.mutual = ?" , true]) > @is_network_owner = false > @is_network_owner = true if params[:id].to_i==session[:user_id] > > render :partial => ''user_search_results'', :locals => {:users => > @users, :@userColleagues => @userColleagues, :@is_network_owner => > @is_network_owner} > > end > ---------------- > Thanks, > Tam-- ==============================================================================Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz ============================================================================== --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<form onsubmit="new Ajax.Updater(''searchResults'', ''/network/search'', {asynchronous:true, evalScripts:true, onComplete:function(request){Element.show(''goBtn'');Element.hide(''fts-loader''); }, onLoading:function(request){Element.hide(''goBtn''); Element.show(''fts-loader'')}, parameters:Form.serialize(this)}); return false;" method="post" action="/network/search"> <table cellpadding="0" border="0" bgcolor="#e5e5e5"> <tbody> <tr> <td> <span class="headerTextGreen">Search </span> </td> <td> <input id="search_phrase" class="search-box" type="text" value="" size="20" name="search_phrase"/> </td> <td width="20"> <input id="goBtn" class="btnSearch" type="image" src="/images/btnGo.gif?1237061985"/> <img id="fts-loader1" width="15" height="14" style="display: none;" src="/images/searchWait.gif?1237061985" alt="Searchwait"/> </td> </tr> </tbody> </table> </form> Thanks Tom... Cheers, Tam -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
try to add :method=>:get into your form_remote_tag ... <% form_remote_tag ( :url => {:controller => "networks", :action => ''search''}, :method => :get, :update => ''searchResults'', :loading => "Element.hide(''goBtn''); Element.show(''fts-loader'')", :complete => "Element.show(''goBtn'');Element.hide(''fts-loader'');") do %> tom Tam Kbe wrote:> <form onsubmit="new Ajax.Updater(''searchResults'', ''/network/search'', > {asynchronous:true, evalScripts:true, > onComplete:function(request){Element.show(''goBtn'');Element.hide(''fts-loader''); > }, onLoading:function(request){Element.hide(''goBtn''); > Element.show(''fts-loader'')}, parameters:Form.serialize(this)}); return > false;" method="post" action="/network/search"> > <table cellpadding="0" border="0" bgcolor="#e5e5e5"> > <tbody> > <tr> > <td> > <span class="headerTextGreen">Search </span> > </td> > <td> > <input id="search_phrase" class="search-box" type="text" value="" > size="20" name="search_phrase"/> > </td> > <td width="20"> > <input id="goBtn" class="btnSearch" type="image" > src="/images/btnGo.gif?1237061985"/> > <img id="fts-loader1" width="15" height="14" style="display: none;" > src="/images/searchWait.gif?1237061985" alt="Searchwait"/> > </td> > </tr> > </tbody> > </table> > </form> > > Thanks Tom... > > Cheers, > Tam-- ==============================================================================Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz ============================================================================== --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Other than ensuring the routing (which seems to be connecting to some action or other), I recommend you also check the submit button you are using. The form remote tag builds a form which has a javascript method called onsubmit() which is what submits the ajax form. If you use some type of custom submit button that one way or another calls form.submit (how non ajax forms are submitted) rather than onsubmit, then you will get what you are seeing now, with the javascript response shown as a page. On Mar 16, 6:57 am, Tom Z Meinlschmidt <to...-ooGa/4BNRfSw0JuIXryQZA@public.gmane.org> wrote:> try to add :method=>:get into your form_remote_tag ... > > <% form_remote_tag ( > :url => {:controller => "networks", :action => ''search''}, > :method => :get, > :update => ''searchResults'', > :loading => "Element.hide(''goBtn''); Element.show(''fts-loader'')", > :complete => "Element.show(''goBtn'');Element.hide(''fts-loader'');") do > %> > > tom > > > > Tam Kbe wrote: > > <form onsubmit="new Ajax.Updater(''searchResults'', ''/network/search'', > > {asynchronous:true, evalScripts:true, > > onComplete:function(request){Element.show(''goBtn'');Element.hide(''fts-loader''); > > }, onLoading:function(request){Element.hide(''goBtn''); > > Element.show(''fts-loader'')}, parameters:Form.serialize(this)}); return > > false;" method="post" action="/network/search"> > > <table cellpadding="0" border="0" bgcolor="#e5e5e5"> > > <tbody> > > <tr> > > <td> > > <span class="headerTextGreen">Search </span> > > </td> > > <td> > > <input id="search_phrase" class="search-box" type="text" value="" > > size="20" name="search_phrase"/> > > </td> > > <td width="20"> > > <input id="goBtn" class="btnSearch" type="image" > > src="/images/btnGo.gif?1237061985"/> > > <img id="fts-loader1" width="15" height="14" style="display: none;" > > src="/images/searchWait.gif?1237061985" alt="Searchwait"/> > > </td> > > </tr> > > </tbody> > > </table> > > </form> > > > Thanks Tom... > > > Cheers, > > Tam > > -- > ==============================================================================> Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache > > www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz > ==============================================================================--~--~---------~--~----~------------~-------~--~----~You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Tom and Jermy. The problem was resolved by using the right version of Rails. The server version was 2.2.2 and my local computer version is 2.1.0. The code I posted worked fine after installing Rails 2.1.0 gem on my server! I might try the solutions you provided if I use later verion of Rails, the code I write might be getting interpreted differently with Rails 2.2.2. Cheers, Tam -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---