This is a migrated thread and some comments may be shown as answers.

JsonP call failed on device but successful in emulator

2 Answers 43 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chi Man
Top achievements
Rank 1
Chi Man asked on 17 Apr 2015, 04:48 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Martin Yankov
Telerik team
answered on 21 Apr 2015, 10:07 AM
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.

 
0
Chi Man
Top achievements
Rank 1
answered on 23 Apr 2015, 10:33 AM

This saved my butt. Thank you.

Tags
General Discussion
Asked by
Chi Man
Top achievements
Rank 1
Answers by
Martin Yankov
Telerik team
Chi Man
Top achievements
Rank 1
Share this question
or