0
var myTableDataObject =[];
serviceAjax.objects().success(function(data){
            myTableDataObject = data.items;
            console.log(myTableDataObject); //here i found my data
}); 

console.log(myTableDataObject); //here i found []

Hi everyone :) How can i init myTableDataObject into this function?

Thanks :)

Anas Bennis
  • 35
  • 1
  • 9
  • The bottom console.log() is made before the AJAX call returns any data; the nature of asynchronicity.. – rsn May 24 '16 at 15:41

1 Answers1

1

This is basic async programmation. The success handler is execute only when you get the service data.

So the rest of your code depending in those data need to be in this handler too.

wilovent
  • 1,364
  • 1
  • 12
  • 15