JsonP call failed on device but successful in emulator

3 posts, 1 answers
  1. Chi Man
    Chi Man avatar
    9 posts
    Member since:
    Apr 2013

    Posted 16 Apr 2015 Link to this post

    Hi,

    i have a web app project, which will access some json through jsonp. Here is the code:

     

    $.ajax(
        { 
          type: "GET",
          url: "http://ewpos.io/Account/TestConnect?inputString=Michael",
          dataType: 'jsonp',
          xhrFields: {
               withCredentials: true
          },
          crossDomain: true,
          success: function(data){
                returnstring = data.ResultMessage;
                console.log("Result String:" + returnstring);
          },
          error: function (xhr) {
                 alert(xhr.responseText);
          }
        }

    After a week of development it was perfectly working in the emulator, but after publishing the app and run on real device, the jsonp call does not return any response.

     Really new to app builder, could anyone give a hand here?

     

    Thanks in advance

     

  2. Answer
    Martin Yankov
    Admin
    Martin Yankov avatar
    177 posts

    Posted 21 Apr 2015 Link to this post

    Hi,

    This sounds a lot like lacking Android INTERNET permission. Go to your Project Properties -> Android -> Permissions and check if the INTERNET permission is turned on. The same has to be done for Windows Phone too.

    Let me know if this was the case.

    Regards,
    Martin Yankov
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  3. Chi Man
    Chi Man avatar
    9 posts
    Member since:
    Apr 2013

    Posted 23 Apr 2015 Link to this post

    This saved my butt. Thank you.

Back to Top