Cancel pending AJAX requests in PHP app?

前端 未结 3 1895
醉酒成梦
醉酒成梦 2021-01-07 23:53

I\'m having problems canceling my XHR requests when navigating between pages. I have a page that has 8 requests that get fired off. I cancel them on click of a link outside

3条回答
  •  温柔的废话
    2021-01-08 00:22

    I assume that you have done that, but check all log files (php and apache).

    Also try this:

    php.ini

    upload_max_filesize = 256M
    post_max_size = 256M
    

    .htaccess

    php_value upload_max_filesize 256M
    php_value post_max_size 256M
    

    Another thing that bugs me is this part.

    $(xm.requests).each(function () {
        var t = this;
        t.abort();
    });
    $(xm.intervals).each(function () {
        var t = this;
        clearInterval(t);
    });
    

    Try passing arguments to the callback and abort through them. I have seen cases, where assigning this to a variable withing $.each loop actually points to a different object or the global window.

    $(xm.requests).each(function (index, value) {
            value.abort();
        });
        $(xm.intervals).each(function (index, value) {
            clearInterval(value);
        });
    

提交回复
热议问题