-1
How do I remove the variable conflict? i already tried to put in a variable the THIS from outside not to generate conflict with the ajax THIS, even so did not change anything!
-1
How do I remove the variable conflict? i already tried to put in a variable the THIS from outside not to generate conflict with the ajax THIS, even so did not change anything!
1
Just one example, but I believe it makes it easier to interpret.
var thisdobotao = this;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
var thisdafuncao = this;
thisdobotao.html('Carregando...')
};
Browser other questions tagged javascript ajax
You are not signed in. Login or sign up in order to post.
Use a global variable or simply
elemento.querySelector
instead ofthis
used to apply theinnerHTML
– Valdeir Psr
global variable does not help; and selecting by the element is not feasible because there are several
– AKU
If possible click on [Edit] and post the code of how you are calling the function; of the function; etc. It is easier to analyze.
– Valdeir Psr
The this that you use inside the function, will always be that of the function. What you need to do there is to save the click on another variable and use it. In other words, the reverse of what you did.
– David Dias
Consider editing your question by adding the code instead of a "print" from the editor.
– Lauro Moraes
Post code and not image
– Matheus Miranda