Jquery/Ajax/Json - Getting to Json

Asked

Viewed 52 times

0

I have an array and need to get to it with jquery/ajax, the problem is that I do not know how to get to it, it is being created by php $json = Array(); then make an array push like this:

array_push($json, array(
    'nome'=>'teste'
));

and then I put the arrays together like this:

$result = array (
    $json,
    $json2,
    $json3
);

giving a console log using ajax, it appears this way json in Chrome:

[Array[2]]
 0:Array[2]
  0:Object
   nome: "teste"

and in ajax Success is like this:

success: function (response) {
    console.log(response);
}

how do I get to the nome: "teste"? I tried that way but I couldn’t: console.log(response.nome);

EDIT: php printout:

[[{"nome":"teste"}]]
  • like printing the array with php?

  • I edited and put in the post

  • 2

    var json = [[{"name":"test"}]; console.log(json[0][0].name); // loop through each array to check the size so as not to lose information and access dynamically...

  • vlw @Gabrielrodrigues!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.