It has been more than a week since I've last posted anything and I knew the next installments would take a while but I find myself at an impasse. This is an issue that I have encountered before, async calls to Pyramid views do not behave as expected but usually there is way around a problem. In this case no matter what I do, a get request via jQuery's $.ajax and or its convenience functions, always results in an empty response and the error handler firing. The HTTP status code has no effect, there are no errors or exceptions coming from the Python code on the server, yet in the browser the error handler for $.ajax always fires and the HTTP response body is empty.
I've checked the code into my GitHub account here, you will need an install of MongoDB at this point to run the app, though you could disable MongoDB easily enough and use whatever data storage technology you desire. I know my client side development skills are lacking, but I've never encountered this much trouble with async calls to a service. So until I figure out what the issue is, and or someone points out to me what I'm missing, this series of posts has come to a standstill.
Note: After posting the above I went back to the project and found issues with the way the response were being constructed and made some changes. There is now the Home view handlers 'get' method and the view function 'async' which return the same content two different ways. If you it either URL mapped to 'Home.get' or 'async' and check the response in FireFox the headers are correct and the response body is there, but if you hit either URL through jQuery's '$.ajax', in this case I'm using the convenience '$.getJSON' the response is missing and the error handler fires. So I've at the very least convinced myself that the server side code is doing what it is suppose to, but there is something deeply wrong with my client side code.
No comments:
Post a Comment