-1
Hello. I have a JS code that works perfectly in other browsers, however, in IE only works with the Debugger (F12) activated.
Follow an excerpt from my JS:
<script src="http://code.jquery.com/jquery-latest.js"></script>
function login(){
var checkCpf = document.getElementById("cpf").value;
var checkPass = document.getElementById("pass").value;
if(checkCpf == '' || checkPass == ''){
document.getElementById("confirmacao").innerHTML="<p>Você precisa informar seu CPF e sua senha para entrar!</p>";
document.getElementById("cpf").value = '';
document.getElementById("pass").value = '';
document.getElementById("cpf").focus();
}else{
if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}else{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200){
var callback = xmlhttp.responseText;
if(callback !=0)
window.location.replace(callback);
else{
document.getElementById("confirmacao").innerHTML="<p>CPF e/ou senha inválidos!</p>";
}
}
}
var params = $('form#login').serialize();
xmlhttp.open("POST","valida.php",false);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(params);
document.getElementById("cpf").value ='';
document.getElementById("pass").value ='';
}
};
Is this all your code? Usually this is caused by a call to
console.log
in the code, but in what you posted...– bfavaretto
Already tried to replace the
jquery-latest.js
by a stable version, which has been proven to work with your version of IE?– mgibsonbr
I managed to solve the problem! @bfavaretto exactly, everything I found talked about the
console.log
, but as you noted, I didn’t touch it. @mgibsonbr I’ve changed, thanks for the tip, but that’s not what solved the problem! The problem is that my IDform
was the same name as the JS function! I just couldn’t figure out what the relationship was with the IE Developer Tools. Thanks for your attention!– Rodrigo M.
@Nod The ideal is that you answer your own question with what solved the problem and mark it as the correct answer.
– user7261