function exe_ajax(pdata,pwait=1) { // async:xasync, xasync=true; // pwait='n'; var msgalert,msgerror,msgsistemas; var xcodi=document.getelem.value; var scrip='libreria.php'; if(pwait==1 || pwait=='w'){xasync=false;document.body.style.cursor = 'progress';} if(pwait==9 || pwait=='n'){xasync=true; document.body.style.cursor = 'default'; } document.body.style.cursor = 'progress'; // if(document.getElementById('pant1')) // {document.getElementById('pant1').innerHTML='
Consultando.....
'+document.getElementById('pant1').innerHTML;} if(document.getElementById('bottom_center')) {document.getElementById('bottom_center').innerHTML=Date();} if(document.getElementById('bottom_right')) {document.getElementById('bottom_right').innerHTML='Ejecutando...';} console.log('Exe A1: '+Date()); var rdata; $.ajax({ cache:false, url:scrip, async:xasync, type:'POST', contentType:false, data:{codigo=xcodi}, processData:false, beforeSend: function(jqXHR, textStatus) { // document.body.style.cursor = 'progress'; if(document.getElementById('bottom_center')) {document.getElementById('bottom_center').innerHTML=Date();} if(document.getElementById('bottom_right')) {document.getElementById('bottom_right').innerHTML='Ejecutando...';} }, success:function(dato, textStatus, jqXHR) { console.log('Exe A2: '+Date()); document.body.style.cursor = 'default'; alert(dato); rdata=dato; msgalert=$(dato).find("msgalert").text(); msgerror=$(dato).find("msgerror").text(); msgsistemas=$(dato).find("msgsistemas").text(); // msgalert=$(dato).find("msgalert").html(); if(msgalert!=='' && msgalert!='undefined'){alert(msgalert);} if(msgerror!=='' && msgerror!='undefined'){alert(msgerror);} if(msgsistemas!=='' && msgsistemas!='undefined'){console.log(msgsistemas);} // if (typeof prueba1 === 'function' ){prueba1 ( );} }, error:function(jqXHR,textStatus,errorThrown ) { document.body.style.cursor = 'default'; console.log('****** ERROR ******'); console.log(_urlinker); console.log(jqXHR.status); // console.log(exception); if(document.getElementById('bottom_center')) { if (jqXHR.status === 0) {document.getElementById('bottom_center').innerHTML='Not connect: Verify Network.';} else if (jqXHR.status == 404) {document.getElementById('bottom_center').innerHTML='Requested page not found [404]';} else if (jqXHR.status == 500) {document.getElementById('bottom_center').innerHTML='Internal Server Error [500].';} else if (exception === 'parsererror') {document.getElementById('bottom_center').innerHTML='Requested JSON parse failed.';} else if (exception === 'timeout') {document.getElementById('bottom_center').innerHTML='Server Not Responding';} else if (exception === 'abort') {document.getElementById('bottom_center').innerHTML='Ajax request aborted.';} else {document.getElementById('bottom_center').innerHTML='Uncaught Error: ' + jqXHR.responseText;} // console.log('ERROR : '+script); } }, complete:function(jqXHR, textStatus) {if(textStatus==='success'){}}, timeout:60000 }); console.log('RESULTADO EXE AJAX'); // console.log(rdata); // document.body.style.cursor = 'default'; if(document.getElementById('bottom_center')) {document.getElementById('bottom_center').innerHTML=Date();} if(document.getElementById('bottom_right')) {document.getElementById('bottom_right').innerHTML='OK';} if(document.getElementById('bottom_right')) {document.getElementById('bottom_right').innerHTML=msgsistemas;} return rdata; }