jquery - Access the interactive backlash/Werkzeug debugger in a failed AJAX request against a TurboGears server -
turbogears features backlash, great interactive debugger in browser, based on werkzeug debugger. when debugging turned on in server configuration, if request fails, server responds interactive web page can watch python traceback can inspected interactively.
however, when developing client-side applications in jquery or angularjs, how can access interactive debugger when ajax request fails?
when ajax requests fail on server, can replace current document contents debug/error document servers response. example, can following:
$.ajax({ url: 'failing_controller/', type: 'post' }) .fail(function _handlefailure(jqxhr, textstatus, errorthrown) { document.open(); document.write(jqxhr.responsetext); document.close(); }) .success(function _handlesuccess(data, textstatus, jqxhr) { // ... handle data ... });
you want replace failure handler more proper in production environment.
Comments
Post a Comment