problem with AJAX when using passenger

what's in the source of generated page? c&p form code

Tam Kbe wrote:

Thanks Tom: Here is the Ruby code

Tam.. I meant html source of generated page with the form...

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

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:

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.