dimanche 10 juillet 2016

Nested $.getJSON() not working in Cordova

Please look at following code, i am unable to execute nested $.getJSON(). My url's are RESTful and when i run them seperatly in fiddler then they are working perfectly. I have also take care of CORS in the methods.

var uri = "http://www.XXXXXX.XXX/WebService/api/controllername/Chk_mehtod/123";

$.getJSON(uri)
.done(function (data) {
   if (jQuery.isEmptyObject(data))
   {
      alert("data empty");
   }
   else
   {
      var Menu_uri = "http://www.XXXXXX.XXX/WebService/api/controllername/Menu_mehtod/465";
      
      alert("Till this alert, code is working");
                          
      $.getJSON(Menu_uri, function (menudata) {
          $.each(menudata, function (index, item) 
          {
             alert("Hyperlink:" + item.Hyperlink);
          });
      })
      .done(function () { alert("Inner Success"); })
      .fail(function () { alert("Inner Error"); });
   }
})
.fail(function () { alert("Outer Error"); });

I am developing my project in cordova...using visual studio 2015.

Any help will be appriciated.

Aucun commentaire:

Enregistrer un commentaire