0
Hi, I have a button that triggers an action Ajax
that leads to a action
in the controlador Symfony
. In the action I can do the select
and see the information I want, but I just can’t get it from Ajax, at view
.
Look at my code:
ajax:
$(document).ready(function() {
$("#idAlterarResponsavelProcedimento").click(function(){
var pessoaId = $("#procedimentos_pessoa_origem").attr('name');
var nome = '<?php echo $nomeFamilia?>';
alert('nome: '+nome);
$.ajax({
cache: false,
type: 'post',
dataType: 'json',
url: '/kwadmin_dev.php/admin/procedimentos/get_responsavel_atual',
data: { pessoa: pessoaId },
success: function(data) {
alert('success - '+JSON.parse(data));
// $("#procedimentos_pessoa_origem").html(data.pessoa);
$("#procedimentos_pessoa_origem").html('estacio');
});
return false;
});
My action:
public function executeGet_responsavel_atual(sfWebRequest $request)
{
$pessoa = $request->getParameter('pessoa');
$this->familiaId = Doctrine::getTable('familias_pessoas')->createQuery('a')
->select('a.id_familia')
->where('a.id_pessoa =' . $pessoa)
->fetchArray();
$this->familiaNome = Doctrine::getTable('familias')->createQuery('f')
->select('nm_familia')
->where('id ='. $this->familiaId[0]["id_familia"])
->fetchArray();
$this->nomeFamilia = $this->familiaNome[0]["nm_familia"];
//echo $this->nomeFamilia;
//die;
// die($nomeFamilia);
}
and that’s my partial who passes the variable to the view:
<?php include_partial('form', array('form' => $form,'nomeFamilia' => $nomeFamilia)) ?>
Ai in source code says: Notice: Undefined variable: nameFamily
i want to bring to the screen the result I got in the variable $nomeFamilia
, but I can’t..