Unserialize Codeigniter - Ajax data?

0

Through the obj_form object, I display the database data in the form:

//Objeto do formulário
function obj_form() {   
    $('[name="id"]').val(obj_permissao.id); 
    $('[name="txt_nome"]').val(obj_permissao.nome);
    $('[name="txt_descricao"]').val(obj_permissao.descricao);   
    $('[name="txt_permissoes"]').val(obj_permissao.permissoes);
    $('[name="sel_grupo"]').val(obj_permissao.grupo);
    $('[name="txt_bgcor"]').val(obj_permissao.bgcor);
    $('[name="sel_situacao"]').val(obj_permissao.situacao);
}

At line $('[name="txt_permissoes"]').val(obj_permissao.permissoes); , there are serialized data, which results:

  

a:8:s:8:"aCliente";s:1:"1";s:8:"eCliente";s:1:"1";s:8:"dCliente";s:1:"1";s:8:"vCliente";s:1:"1";s:9:"aOperador";s:1:"1";s:9:"eOperador";s:1:"1";s:9:"dOperador";s:1:"1";s:9:"vOperador";s:1:"1";}

The question is: How can I

asked by anonymous 20.07.2017 / 21:24

1 answer

0

Hello

I want to inform you that I have decided as follows: I used the php-unserialize-js plugin .

And I converted the string into an object: var permissoes = phpUnserialize(obj_permissao.permissoes); console.log(permissoes);

Result:
aCliente:null aOperador:null dCliente:null dOperador:null eCliente:null eOperador:null vCliente:"1" vOperador:"1"

    
21.07.2017 / 17:48