0

I am working on the following code. I'm trying to find out why I am getting this error:

The Points undefined

on processMap() ?

var mapPoints = function(model, viewSetting) {
    ajax(_workSpace.rootPath + 'Map/MapPoints', { }, function (result) {
        console.log('headMapOrders callback ', result);
        if (result.ReturnCode == 0) {
            UIPopup.showOk(result.ReturnMessage, resources.app_error);
        } else {}
       return;
    });
}       

function processMap()
{   
        var thepoints = mapPoints();
        console.log("The Points", thepoints);
}

processMap();
halfer
  • 19,824
  • 17
  • 99
  • 186
user1760110
  • 2,256
  • 5
  • 29
  • 37
  • `Ajax` is asynchronous. So the `console.log` would already have been executed before the request returns. If you want to return ( which the function is not currently) you can use the concept of `Promise` – Sushanth -- Jan 12 '17 at 19:23
  • 2
    first of all, `mapPoints` doesn't return anything – mic4ael Jan 12 '17 at 19:23

0 Answers0