Request item is not returning in ajax Function

Asked

Viewed 98 times

0

I have a problem in my application in which I have not the least idea how to solve, let alone the reason for the problem

It turns out that an index is not specifically returning in my request within the jquery function

$.ajax({
        url: "http://",
        type: 'POST',
        data: {texto: text},
        success: function(data){
            console.log(data);
        }

    });

inserir a descrição da imagem aqui

So far everything is perfect!

But look what returns in the console.log

inserir a descrição da imagem aqui

Within the function it returns only the array items, and not the sugestions as well,

It would be right to return this

inserir a descrição da imagem aqui

I don’t even know how to research this.

In php there is nothing else, just the results, and then a json_encode()

$return->suggestions= $suggestions->suggestions;
$return->items      = $this->getImagem($produtos);

return json_encode($return);
  • What you have in PHP?

  • just a json From what I showed above, I’ll put it in the post

  • has already tried to change the $return->items to another name to see if it is not a jQuery helper who does it ? for example $return->produtos

  • I will make the change here, but just remembering that the item that is not returning is "suggestions" and not "items

  • Try this: var_dump($Return); die(); and see what returns.

No answers

Browser other questions tagged

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