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:
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
?– Sergio
_url is a file variable itself that returns the open page.
– mend3
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– Tiago César Oliveira
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.– mend3
Vitor, my question is whether you are using relative path or not. This can be seen as CORS
– Sergio
No, Sergio. You are only using the name of the file as a reference, as I commented right there (
_url = 'banner.php';
)– mend3
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.
– mend3
How about putting the comment as a response and mark as solved?
– Joao Paulo
Victor, I think it’s worth adding this information as a response
– Sergio