0
My problem is the following I have a search field that brings data in a table via ajax, in this table has buttons so that the user can get more information about the data that are searched, in these buttons I’m trying to call this second information also via ajax the problem is that the second ajax is always returning blank do not know what happens.
this is the table, the onclick goes to show phase function I will post right below.
<td>'.$exf_obj->nom_req.'</td>
<td>'.$reg['descricao'].'</td>
<td>'.$reg['dtfase'].'</td>
<td>'.$exf_obj->n_proce.'</td>
<input type="hidden" value='.$reg['sql_rowid'].' id="id_fase">
<td><a href="" onclick="return mostrar_fase()" class="tiny button">Mostrar mais</a></td>
<td><a href="Busca/mostrar/'.$reg['sql_rowid'] .'" class="tiny button">Mostrar mais</a></td>
</tr>';
The function of ajax is this
function mostrar_fase(){
ajax = xmlhttp();
id_fase = document.getElementById('id_fase').value;
if(ajax)
{
ajax.open("POST",'http://localhost/sac/Ajax/mostrar_fase/' + id_fase, true);
alert(ajax.responseText);
ajax.onreadystatechange = function()
{
if (ajax.readyState == 4 && ajax.status == 200)
{
document.getElementById("tabela").innerHTML = ajax.responseText;
}
}
ajax.send();
}
}
case 'mostrar_fase':
echo 'chega';
$id_fase = Sistema::getKey();
Connection::open();
$dados_fase = Connection::select("select * from fases01 where sql_rowid = '".$id_fase."'");
$reg_fase = $dados_fase->fetchObject();
$dados_exf = Connection::select("select * from arq_exf where num_pro = '".$reg_fase->processo."'");
$reg_exf = $dados_exf->fetchObject();
$html = $html = new Html();
$nova = $html->carregar('view/mostrar.html');
$nova = str_replace('#NOME#', $reg_exf->nom_req, $nova);
$nova = str_replace('#DESCRICAO#', $reg_fase->descricao, $nova);
echo $nova;
break;
the first ajax code is practically equal to the one I posted only differs the link and the variable and the first works correctly. I hope I have been clear in my question. Thank you since.
When you access the ajax link manually appears some error?
– rray
no, when accessing the link manually returns what I need. A doubt I have whether it is possible to use one ajax right after another.
– user3061295
Post the code of
xmlhttp
.– Guilherme Nascimento