2

I have the following code:

function test() {

 $.when(MyModule.loadData("breadcrumbs", "BreadcrumbsData", jsndata, 'GET')).then(
   function (data) {

      return data;
   });
}

var result = test();

Problem: I am not getting the data in 'result' variable.

I am using Jquery 3.x.

MyModule.loadData is a method that executes a synchronous ajax request and returns the jqXHR object.

Thanks.

Ashish Bahl
  • 1,482
  • 1
  • 18
  • 27
Alon S
  • 107
  • 13

1 Answers1

2
function test() {

 return $.when(MyModule.loadData("breadcrumbs", "BreadcrumbsData", jsndata, 'GET')).then(
   function (data) {
      return data;
   });
}

var result;
test().then(function(data){
    result = data;
}).then(function(){
    console.log(result);
});
Vladu Ionut
  • 8,075
  • 1
  • 19
  • 30