0
I am not getting the answer in the ajax request. The code does not confirm whether it is working or not.
<script type="text/javascript">
function iniciarAjax(){
var ajax = false;
if(window.XMLHttpRequest){
ajax = new XMLHttpRequest();
}else if(window.ActiveXObject){
try{
ajax = new ActiveXObject("Msxml2.XMLHttpRequest");
}
catch(e){
try{
ajax = new ActiveXObject("Microsoft.XMLHttpRequest");
}catch(ex){
ajax = false;
}
}
}
return ajax;
}
var conectarServidor = iniciarAjax();
if(conectarServidor){
conectarServidor.onreadystatechange = function(){
if(conectarServidor.readyState == 4){
if(conectarServidor.status == 200{
alert("Tudo certo")
}
else{
alert("Problema ocorreu")
}
}
conectarServidor.open("GET","http://localhost/locadora/cadastro.php");
conectarServidor.send();
}
}
</script>
I put the code you used in the answer here, to be in the question and not in an answer, because it was part of the question. You can always click [Edit] to add details to the question.
– Sergio