How do I debug jquery AJAX calls?

后端 未结 10 1389
悲&欢浪女
悲&欢浪女 2020-11-29 05:19

I have been working on trying to get AJAX to work with Jquery. My big issue so far has been that I don\'t really know how to figure out where I\'m making a mistake. I don\'t

10条回答
  •  广开言路
    2020-11-29 05:31

    Just add this after jQuery loads and before your code.

    $(window).ajaxComplete(function () {console.log('Ajax Complete'); });
    $(window).ajaxError(function (data, textStatus, jqXHR) {console.log('Ajax Error');
        console.log('data: ' + data);
        console.log('textStatus: ' + textStatus);
            console.log('jqXHR: ' + jqXHR); });
    $(window).ajaxSend(function () {console.log('Ajax Send'); });
    $(window).ajaxStart(function () {console.log('Ajax Start'); });
    $(window).ajaxStop(function () {console.log('Ajax Stop'); });
    $(window).ajaxSuccess(function () {console.log('Ajax Success'); });
    

提交回复
热议问题