Why does not my PHP code receive a $ _GET parameter?

0

I have an html form in which you have several button-type elements and each with an onclick event. The onclick function does the following. Make a request with ajax and show data from a certain table in a database. Each button consults different tables. Anyway, what happens is that with the first button that I press everything happens perfectly. The $ _GET is received without problem. But when I use the other buttons it seems that they ignore the part of the onclick function to make the request, they do not respond. It is perhaps a problem with the types of buttons, I have no idea, my requests are correctly formulated, I know.

Ignoring the SARCASM of some, here goes the code:

Javascript

var PeticionAjax01 = new objeto_ajax(); //Definimos un nuevo objetoAjax.

var PeticionAjax02 = new objeto_ajax(); //Definimos un nuevo objetoAjax.


PeticionAjax01.completado = objetoRequestCompletado01; /*Función completado del objetoAjax redefinida. */

PeticionAjax02.completado = objetoRequestCompletado02; 

var nombre_panel=  "div#panel-personal";//PANEL CUYO CONTENIDO SE MODIFICARA SEGUN SE DESEE VER DATOS DE CARACTER PERSONAL
//JUDICIAL, SITUACION PENITENCIARIA, ETC



function objetoRequestCompletado01(estado, estadoTexto,respuestaTexto, respuestaXML){

$('div#panel-resultados').html( respuestaTexto);
//Solo nos interesa la respuesta como texto
}


function objetoRequestCompletado02(estado, estadoTexto,respuestaTexto, respuestaXML){

$(nombre_panel).html(respuestaTexto); 
//Solo nos interesa la respuesta como texto
}





function consulta_general() {

var seleccion= $('input:radio[name=radio-ci]').val();

var valor= $('input:text[name=txtbusqueda]').val();

var ruta= "consu_mdb2.php?cedula="+valor+"&tipo_bus="+seleccion;

PeticionAjax01.tomar(ruta);
}



function consulta_especi(tipo,posicion) { 

nombre_panel= nombre_panel+ posicion;

var ruta= "consu_mdb2.php?panel="+tipo+"&posicion="+posicion;

alert(ruta); 

PeticionAjax02.tomar("testing.php?panel="+tipo);

}

ajax

function ConstructorXMLHttpRequest()

{
if(window.XMLHttpRequest) 
{

return new XMLHttpRequest();


}
else if(window.ActiveXObject)
{


var versionesObj = new Array(
'Msxml2.XMLHTTP.5.0',
'Msxml2.XMLHTTP.4.0',
'Msxml2.XMLHTTP.3.0',
'Msxml2.XMLHTTP',
'Microsoft.XMLHTTP');

for (var i = 0; i < versionesObj.length; i++)
{

try
{

return new ActiveXObject(versionesObj[i]);

}
catch (errorControlado)
{
	//Capturamos el error, ya que podría crearse otro objeto.
}
}
}


throw new Error("No se pudo crear el objeto XMLHttpRequest");
} 	

ajax request class

function objeto_ajax() {

this.objetoRequest= new ConstructorXMLHttpRequest();


this.tomar= function funcionAsincrona(Url) {

var objetoActual= this;

this.objetoRequest.open('GET', Url, true);

this.objetoRequest.onreadystatechange= 

function() {
switch(objetoActual.objetoRequest.readyState)
{

case 1: //Función que se llama cuando se está cargando.
objetoActual.cargando();

break;
case 2: //Función que se llama cuando se a cargado.
objetoActual.cargado();

break;
case 3: //Función que se llama cuando se está en interactivo.
objetoActual.interactivo();

break;
case 4: 
objetoActual.completado(objetoActual.objetoRequest.status,
objetoActual.objetoRequest.statusText,
objetoActual.objetoRequest.responseText,
objetoActual.objetoRequest.responseXML);

break;
}/**fin switch **/
};
this.objetoRequest.send(null);


}/** fin funcion asincrona **/

this.cargando = function objetoRequestCargando() {}

this.cargado = function objetoRequestCargado() {}

this.interactivo = function objetoRequestInteractivo() {}

this.completado=   function objetoRequestCompletado(estado,estadoTexto, respuestaTexto, respuestaXML) {}

}
    
asked by Sonia Toledo 07.07.2017 в 16:43
source

0 answers