net error::ERR_BLOCKED_BY_CLIENT when making Ajax request

Asked

Viewed 17,125 times

10

I came across a strange error when I tried to execute an ajax request, and I was not very successful in finding solutions.

That is the error:

Erro jQuery

The line 199 of forms.js is the $.ajax({ in:

$.ajax({
    type: "POST",
    url: _url,
    cache: false,
    data: {
        type: 'excluir',
        key: _data
    },
    dataType: 'json',
    success: function(data) {
        //success
    }
});

PS.: I’ve tried switching $ for jQuery but it didn’t work. PS. 2: References and calls from jQuery libraries are in the correct order.

The strange thing is that this same file works on all other pages, since it is my global file for processing forms.

  • how the _url?

  • _url is a file variable itself that returns the open page.

  • Is it a post for the same page, or for a different server? It may be necessary to CORS server enabled, if different domain/protocol/port

  • It is for the same page. As you can see in the error, I am trying to send from the page "banner.php", ie, _url = 'banner.php';. I am running in local mode, via xampp, all standard.

  • Vitor, my question is whether you are using relative path or not. This can be seen as CORS

  • No, Sergio. You are only using the name of the file as a reference, as I commented right there (_url = 'banner.php';)

  • Well, I did a larger search and found references in this link https://code.google.com/p/adblockforchrome/issues/detail?id=6369. I tested in firefox (and it worked). In fact, it wasn’t code error or anything, it was just Adblock (Chrome extension) blocking the request. If someone has the same problem in the future, just add the domain to the list of permissions.

  • 1

    How about putting the comment as a response and mark as solved?

  • 1

    Victor, I think it’s worth adding this information as a response

Show 4 more comments

4 answers

21


Well, I did a bigger sweep and I found references at this link.

I tried it on firefox (and it worked). Actually, it wasn’t code error or anything, it was just Adblock (Chrome extension) blocking the request.

If someone has the same problem in the future, just add the domain name (even if it is localhost) to the list of permitted.

  • 3

    kkkkkkkkkkk tense when the shot backfires. But that was it. I just paused Addblock that the error did not occur anymore. Thank you.

  • 1

    puts, I had to change the path.... kkkkk

1

Just to help those who are seeing this answer: Probably Adblock blocked this request because it had the word banner in the URL. Even if you pause Adblock to develop, this AJAX might not work for some user who is using Adblock (because he hasn’t paused Adblock on his website, and probably won’t). My suggestion is to change the word banner from the url to some other word.

0

To extension of Avast blocks some analysis scripts (Google Analytics, for example) and social networks.

Just add the domains of the blocked scripts as an exception in the settings of the Avast extension it now allows the execution of these scripts.

In addition to the Addblock also blocks some features, as the mend3 said in his answer,

0

  • I never suffered this problem, the cause was simply Adblock Plus. But it remains and I appreciate the tip ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.