Search code examples
javascriptpjax

pjax request change status to canceled as soon as it fires


here is my code

$(document).on('click', '#global-search-button', function() {


    $.pjax({
        url: "http://localhost/project/brows",
        container: '#pjax-container',
        timeout: 9000000 ,
    })

});

when i click on the button

enter image description here

her here is more info on request

Request URL: http://localhost/project/brows?_pjax=%23pjax-container
Referrer Policy: no-referrer-when-downgrade
Provisional headers are shown
Accept: text/html, */*; q=0.01
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://localhost/project/brows
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36
X-PJAX: true
X-PJAX-Container: #pjax-container
X-Requested-With: XMLHttpRequest
_pjax: #pjax-container

i have to add some more info to be able to post the question , so here it is


Solution

  • the reason was very simple and odd , basically if the href of the link should be a # it would cancel as soon as it fires .... i changed it to javascript:void(0) and it worked