Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : ajax call to database example

$
0
0
It looks like you are trying to log out the return from GetDataFromServer() in a synchronous fashion - the console log should be inside a done() callback chained onto the end of GetDataFromServer() as $.ajax() is an asynchronous method by nature.

I do believe you can set $.ajax() to be synchronous but I would advise you stick to the conventions used throughout JMVC models which return a promise().

  1. GetDataFromServer().done(function(data) {
  2.       console.log(data);
  3. });



Viewing all articles
Browse latest Browse all 3491

Trending Articles