It's the first time I write, since I almost always find the answer solved without having to explain it before.
My query is as follows:
I have a index.php with a div to load a list of users in the upper part and another in the lower one where the data of the row I select in the upper div is loaded through from another php.
The case is that when ready for example a list of users and pulse in a row to load down your complete data, I load them perfectly but I do not work the buttons of the forms, does not send to the destination file of the form action="file.php" , click on the submit button and do nothing.
function ajaxFunction() {
var xmlHttp;
try
{
xmlHttp=new XMLHttpRequest();
return xmlHttp;
} catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
return xmlHttp;
} catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
return xmlHttp;
} catch (e)
{
alert("Tu navegador no soporta AJAX!");
return false;
}}}
}
function Enviar(_pagina,capa)
{
var ajax;
ajax = ajaxFunction();
ajax.open("POST", _pagina, true);
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.onreadystatechange = function() {
if (ajax.readyState==1){
document.getElementById(capa).innerHTML = " Aguarde por favor...";
}
if (ajax.readyState == 4) {
document.getElementById(capa).innerHTML=ajax.responseText;
}}
ajax.send(null);
That's the ajax code to send a .php to a specific div, that php contains the following:
echo "
<table>
<th colspan='20'><form action='listarusers.php' method='post' name='busco'><input type='search' style='margin:9px;background-color:white' name='busqueda'placeholder='Buscar aqui...'autofocus size='100' ><input type='submit' name='buscar' value='Buscar'/>
</form></th>
<tr>
<th colspan=3>El usuario no existe, ¿deseas crearlo?<th><tr>
<th colspan=3></th><tr>
<th>Cuenta</th> <th>Datos personales</th> <th>Datos de contacto</th><tr>
<form action='add.php' method='post' onsubmit='return validar(this);'>
<td><label>Nombre usuario: </label><label><input type='text' size='' class='txt' name='Nusuario' value='' required/></label><br>
<label>Contraseña: </label><label><input type='text' size='' class='txt' name='Password' value='' required /></label><br>
<label>Fecha registro: </label><input type='text' size='' class='txt' name='Fregistro' value='".date('Y-m-d')."' /><br>
<label>Nivel membresia: </label><input type='text' size='' class='txt' name='Nivelmembresia' value='1' /><br>
<label>Rango: </label><input type='text' size='' class='txt' name='Rango' value='USR' /><br>
<label>Activado: </label><input type='text' size='' class='txt' name='Activado' value='0' /><br>
<label>Premium: </label><input type='text' size='' class='txt' name='Premium' value='0' /><br>
</td>
<td>
<label>Nombre: </label><input type='text' size='' class='txt' name='Nombre' value='' /><br>
<label>Apellidos: </label><input type='text' size='' class='txt' name='Apellidos value='' /><br>
<label>Genero: </label><input type='text' size='' class='txt' name='Genero' value='' /><br>
<label>Fecha nacimiento: </label><input type='text' size='' id='cal_".$contador++."' class='txt' name='Edad' value='2000-07-30' /><br>
<label>Direccion: </label><input type='text' size='' class='txt' name='Direccion' value='' /><br>
<label>Ciudad: </label><input type='text' size='' class='txt' name='Ciudad' value='' /><br>
<label>Provincia: </label><input type='text' size='' class='txt' name='Provincia' value='' /><br>
<label>CP: </label><input type='text' size='' class='txt' name='Cpostal' value='' /><br>
<label>Pais: </label><input type='text' size='' class='txt' name='Nacionalidad' value='España' /><br>
</td>
<td>
<label>Email: </label><input type='text' size='' class='txt' name='Email' value='' /><br>
<label>Telefono: </label><input type='text' size='' class='txt' name='Telefono' value='' /><br>
</td><tr>
<td colspan='3'><center><input type='submit' style='margin-left:px;' alt='Añadir' value='Añadir' /></center></td><tr>";
The fact is that the form does not work, you press in the add or update and do nothing.
The same thing happens to me with a calendar in jquery, if I load the php bareback it works all forms and submits but I charge it in a div with the function of ajax They do not work.