How to send back a response to an Ajax.request call

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.

On Mar 22, 3:05 pm, Mc Ieong [email protected] 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 ?

Fred

Frederick C. wrote:

On Mar 22, 3:05�pm, Mc Ieong [email protected] 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 ?

Fred

Sorry, 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs