0

Ok, this sounds super easy but still I have not found an answer that could help me.

I have this ajax callback inside a jquery function

$.ajax({ url: '<?php echo base_url(); ?>index.php/Im_general/obtenerDireccionAlmacen', method: 'POST', data: { idAlmacen: idAlmacen }, success: function (returned) { var result = JSON.parse(returned); console.log(result.direccion); //here I set the returned string as input value } }); 

I call a function from the database and expect a single string that I will append to a text input. In the console output I can verify that the callback is working properly, as you can see in the image. But I still do not know how to get the value that is underlined.

Console output

Also, should I use succes or done for the callback?

2
  • try: console.log((result.direccion)[0].domicile); Commented May 26, 2017 at 18:45
  • @techLove Thanks!! It works. Commented May 26, 2017 at 18:47

2 Answers 2

2

This is simply an object.

console.log((result.direccion)[0].domicile); 
Sign up to request clarification or add additional context in comments.

Comments

1

result.direccion[0].domicile would satisfy your need

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.