Hello, I have the following Ajax call which invoke the action
"check_skills"
    new Ajax.Request(''/persons/check_skills''
        {   method:''post'',
      asynchronous: false,
      evalScripts:false,
      onSuccess: function(transport){
        var response = transport.responseText || "no response text";
        alert("Success! \n\n" + response);     },
        onFailure: function(){
          alert(''Something went wrong...'')
          }
        });
The action did get called but the above code always go to "onFailure"
part, doesn''t anyone konw how the action "check_skills" can
return some
value back to the Ajax.request call?
Thanks in advance.
-- 
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-/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.
Frederick Cheung
2010-Mar-22  15:29 UTC
Re: How to send back a response to an Ajax.request call
On Mar 22, 3:05 pm, Mc Ieong <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hello, I have the following Ajax call which invoke the action > "check_skills" > > new Ajax.Request(''/persons/check_skills'' > { method:''post'', > asynchronous: false, > evalScripts:false, > onSuccess: function(transport){ > var response = transport.responseText || "no response text"; > alert("Success! \n\n" + response); }, > onFailure: function(){ > alert(''Something went wrong...'') > } > }); > > The action did get called but the above code always go to "onFailure" > part, doesn''t anyone konw how the action "check_skills" can return some > value back to the Ajax.request call?What response is it returning ? Fred> > Thanks in advance. > -- > Posted viahttp://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-/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.
Frederick Cheung wrote:> On Mar 22, 3:05�pm, Mc Ieong <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> � � � � onFailure: function(){ >> � � � � � alert(''Something went wrong...'') >> � � � � � } >> � � � � }); >> >> The action did get called but the above code always go to "onFailure" >> part, doesn''t anyone konw how the action "check_skills" can return some >> value back to the Ajax.request call? > > What response is it returning ? > > FredSorry, I got it wrong: I didn''t render anything in the action, now is okay when I add this statement in the action: render :js => "alert(''Render succeed.'')" Thank you very much! Ieong -- 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-/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.