2009/6/14 Abe Ced <[email protected]>: > > Hi, > > I've done AJAX calls to Rails' Controllers before yet never required to > generate a response back to the view. In this respect, I have tried to > keep it moronically simple and just add a node to see that it works, yet > the response doesn't come through / isn't interpreted as it should. Long > story short, code : > > // Have to use Mootools to integrate a Moo-specific JS Script > > // @.js : > > new Request( > { > url: 'bla' > onSuccess: function(responseText, responseXML) > { > console.warn(responseText); > console.warn(responseXML); > } > , > onFailure: function(xhr) > { > alert(STD_ERR); > } > > }).send(); > > // @SomeController : > > respond_to do |format| > format.html { head :ok } > format.xml { render :xml => ({:foo => "bar"}.to_xml) } > end > > // Have tried format.json, with all the code involved (:json, .to_json), > yet > // nothing. The to_xml Method works in irb. > > The responseText is "" and responseXML is Null on the callback. This is > basic stuff, can't see past my noobness :). So I just want to render > some xml back to the view, no models or anything yet. I have to mention > that Content-Length is set on the response header. I'm thinking it's a > no-brainer though :) >
Have you proven to yourself that it is getting to your controller action ok? For example by breaking in with ruby-debug. 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

