Yes, I'm not 100% on the status code, as I saw this '0' in the Prototype transport response object, though Firebug is telling me that it is a 200. I can reproduce this behavior by setting up a web2py instance with a controller:
def index2(): return 'XYZ' and then an html page with the prototype code: new Ajax.Request("http://localhost:8000/welcome/default/index2", { method: 'get', onComplete: function(transport) { alert(transport.responseText); } }); I see no response text when the script runs. Thanks so much for your help Alex On Oct 13, 11:18 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > PS. If you point us to the service I will give it a try. > > On Oct 13, 10:10 pm, pharkle <alex.farr...@gmail.com> wrote: > > > Hi, I'm hitting a REST service that is running web2py that is supposed > > to return JSON. When I curl the endpoint or hit it in a browser, I > > get a valid 200 response with the JSON I expect in the body of the > > response. However, when I GET this same URL using Prototype's > > Ajax.Request function, I get a nil response in the body and a 0 status > > code. This is very strange to me. I am not a Python developer, so I > > have limited understanding of the situation, but this should work, > > right? > > > In *achem* Rails, I would do something like this on my controller to > > set up an appropriate response to an ajax request: > > > respond_to do |format| > > format.js { render :text => "myjsonstuff" } > > end > > > Is there something comparable in web2py or is there another way to get > > this thing working? I am assuming it has something to do with the XHR > > headers as curling the url works fine. > > > Thanks, > > Alex --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---