In my view I have this test...
<%= link_to_remote(''AJAX Alert'', :url =>
''/sandbox/submit'', :success
=> ''alert(request.responseText)'') %>
In my controller, this works and outputs "AJAX Response"...
  def submit
    render :layout => false
  end
But if I add the respond_to block, the format.js never gets
recognized...
  def submit
    respond_to do |format|
      format.js {
        render :layout => false
      }
      format.any(:html, :mobi, :touch) {
        # render normal layout
      }
    end
  end
-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
In my view I have this test...
<%= link_to_remote(''AJAX Alert'', :url =>
''/sandbox/submit'', :success
=> ''alert(request.responseText)'') %>
In my controller, this works and alerts "AJAX Response"...
  def submit
    render :layout => false
  end
But if I add the respond_to block, the format.js never gets
recognized...
  def submit
    respond_to do |format|
      format.js {
        render :layout => false
      }
      format.html {
        # render normal layout
      }
    end
  end
-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On 15 March 2010 20:45, Sav <savarino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> In my view I have this test... > > <%= link_to_remote(''AJAX Alert'', :url => ''/sandbox/submit'', :success > => ''alert(request.responseText)'') %> > > In my controller, this works and outputs "AJAX Response"... > > def submit > render :layout => false > end > > But if I add the respond_to block, the format.js never gets > recognized... > > def submit > respond_to do |format| > format.js { > render :layout => false > } > format.any(:html, :mobi, :touch) { > # render normal layout > } > end > endI am a bit outside my comfort zone here, but should that be :url => ''/sandbox/submit.js'' above if you want to specify format.js in respond_to Colin> > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Ahha!  That works, and I found my problem was due to my
application_controller''s before_filter...
before_filter :detect_request
def detect_request
  if request.subdomains.first == ''iphone''
    request.format = :iphone
  end
end
I have to change my respond to use format.any(:js, :touch)
Thanks!
On Mar 15, 2:11 pm, Colin Law
<clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
wrote:> On 15 March 2010 20:45, Sav
<savar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > In my view I have this test...
>
> > <%= link_to_remote(''AJAX Alert'', :url =>
''/sandbox/submit'', :success
> > => ''alert(request.responseText)'') %>
>
> > In my controller, this works and outputs "AJAX Response"...
>
> >  def submit
> >    render :layout => false
> >  end
>
> > But if I add the respond_to block, the format.js never gets
> > recognized...
>
> >  def submit
> >    respond_to do |format|
> >      format.js {
> >        render :layout => false
> >      }
> >      format.any(:html, :mobi, :touch) {
> >        # render normal layout
> >      }
> >    end
> >  end
>
> I am a bit outside my comfort zone here, but should that be :url =>
> ''/sandbox/submit.js'' above if you want to specify
format.js in
> respond_to
>
> Colin
>
>
>
> > --
> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > For more options, visit this group
athttp://groups.google.com/group/rubyonrails-talk?hl=en.
-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Shit, this is exactly the same problem but it went unsolved... http://www.ruby-forum.com/topic/183367#806585 RJS seems to be a problem when setting up iphone mime-types... Mime::Type.register_alias "text/html", :iphone On Mar 15, 2:36 pm, Sav <savar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ahha! That works, and I found my problem was due to my > application_controller''s before_filter... > > before_filter :detect_request > > def detect_request > if request.subdomains.first == ''iphone'' > request.format = :iphone > end > end > > I have to change my respond to use format.any(:js, :touch) > > Thanks! > > On Mar 15, 2:11 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > On 15 March 2010 20:45, Sav <savar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > In my view I have this test... > > > > <%= link_to_remote(''AJAX Alert'', :url => ''/sandbox/submit'', :success > > > => ''alert(request.responseText)'') %> > > > > In my controller, this works and outputs "AJAX Response"... > > > > def submit > > > render :layout => false > > > end > > > > But if I add the respond_to block, the format.js never gets > > > recognized... > > > > def submit > > > respond_to do |format| > > > format.js { > > > render :layout => false > > > } > > > format.any(:html, :mobi, :touch) { > > > # render normal layout > > > } > > > end > > > end > > > I am a bit outside my comfort zone here, but should that be :url => > > ''/sandbox/submit.js'' above if you want to specify format.js in > > respond_to > > > Colin > > > > -- > > > 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-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm. > > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Got it! headers["Content-Type"] = "text/javascript" render :action => ''submit.js.rjs'' Whew. On Mar 15, 2:58 pm, Sav <savar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Shit, this is exactly the same problem but it went unsolved...http://www.ruby-forum.com/topic/183367#806585 > > RJS seems to be a problem when setting up iphone mime-types... > > Mime::Type.register_alias "text/html", :iphone > > On Mar 15, 2:36 pm, Sav <savar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Ahha! That works, and I found my problem was due to my > > application_controller''s before_filter... > > > before_filter :detect_request > > > def detect_request > > if request.subdomains.first == ''iphone'' > > request.format = :iphone > > end > > end > > > I have to change my respond to use format.any(:js, :touch) > > > Thanks! > > > On Mar 15, 2:11 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > On 15 March 2010 20:45, Sav <savar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > In my view I have this test... > > > > > <%= link_to_remote(''AJAX Alert'', :url => ''/sandbox/submit'', :success > > > > => ''alert(request.responseText)'') %> > > > > > In my controller, this works and outputs "AJAX Response"... > > > > > def submit > > > > render :layout => false > > > > end > > > > > But if I add the respond_to block, the format.js never gets > > > > recognized... > > > > > def submit > > > > respond_to do |format| > > > > format.js { > > > > render :layout => false > > > > } > > > > format.any(:html, :mobi, :touch) { > > > > # render normal layout > > > > } > > > > end > > > > end > > > > I am a bit outside my comfort zone here, but should that be :url => > > > ''/sandbox/submit.js'' above if you want to specify format.js in > > > respond_to > > > > Colin > > > > > -- > > > > 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@googlegroups.com. > > > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.