AjaxCallBack was not called, windows phone phonegap
NickName:Muhammad Owais Ask DateTime:2015-09-04T15:24:20

AjaxCallBack was not called, windows phone phonegap

I am trying to connect WCF RESTful C# API to phonegap application using angularjs. My html working perfect in Web but no in my windows phone.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" data-ng-app="myApp">
<head>
    <meta charset="utf-8" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="msapplication-tap-highlight" content="no" />
    <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
    <link rel="stylesheet" type="text/css" href="css/index.css" />
    <title>Profile</title>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />

</head>
<body>
    <div>
        <div data-ng-controller="ProfileCtrl">
            First Name: {{FirstName}}
            Last Name: {{LastName}}
        </div>
    </div>

    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
    <script type="text/javascript">
        app.initialize();
    </script>
    <script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
    <!--<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>-->
    <script type="text/javascript" src="js/angular.min.js"></script>

    <script>

        var myApp = angular.module('myApp', []);

        window.jsoncallback = function (json) {
            debugger;

            if (!json.Error) {

                alert("run callback");
                //alert("success");
            }
            else {

                alert(json.Message);
            }
        }
        
        myApp.controller('ProfileCtrl', ["$scope", "$http", function ($scope, $http) {

            function LoadProfile() {

                debugger;

                var call_url = 'http://localhost:53834/LoginService.svc/UserProfile/1';


                //For jsonp calling
                //alert("Running Jsonp");
                //$http.jsonp(call_url).success(function (data) {
                //    debugger;
                //});
                

                alert("Running Ajax");
                $.ajax({
                    url: call_url,
                    type: "POST",
                    dataType: "jsonp",  // from the server
                    crossDomain: true,
                    contentType: "application/json; charset=utf-8", // to the server
                    jsonpCallback: 'jsoncallback',
                    success: function (data) {
                        alert("success");
                        $scope.FirstName = data.FirstName;
                        $scope.LastName = data.LastName;
                        $scope.$apply();
                    },
                }).done(function (data) {
                    debugger;
                    console.log(data);

                }).fail(function (xhr, status, error) {
                    debugger;
                    alert(xhr.status + " " + status + " " + error);
                });
            };

            LoadProfile();
        }]);

    </script>

</body>
</html>

Copyright Notice:Content Author:「Muhammad Owais」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/32392382/ajaxcallback-was-not-called-windows-phone-phonegap

More about “AjaxCallBack was not called, windows phone phonegap” related questions

AjaxCallBack was not called, windows phone phonegap

I am trying to connect WCF RESTful C# API to phonegap application using angularjs. My html working perfect in Web but no in my windows phone. &lt;!DOCTYPE html&gt; &lt;html xmlns="http://www....

Show Detail

pagebeforeshow not called in windows phone 7 phonegap application...?

I've done with my android,blackberry,ios phonegap application. Now I just port it through windows phone 7 application. But here $(document).on('pagebeforeshow', '#preference', function () { ...

Show Detail

Windows Phone 8 Development with Phonegap

I have jut read this documentation http://phonegap.com/blog/2012/12/21/apache-cordova-and-windows-phone-8/, and I need to ask a very simple question. I know you cant do Windows Phone 8 development

Show Detail

Cordova/phonegap windows phone plugins

I am having problems getting a phonegap windows phone app up and going. (PhoneGap 3.1.0 - on a windows 8 machine) I have followed the step so create a windows phone app from the “Windows Phone Com...

Show Detail

PhoneGap with WIndows Phone Access Origin?

I'm using Phonegap to build an application for multiple platforms, one of which is windows phone. I had a similar problem with other platforms with having Ajax grab content from an XML file on th...

Show Detail

PhoneGap geolocation and Windows Phone8

According to PhoneGap documentation, the Geolocation API are not available for Windows Phone 8. But according caniuse.com (http://caniuse.com/geolocation), the HTML5 geolocation is available for W...

Show Detail

Phonegap using CLI to compile windows phone app

Pardon me for asking, or pointing this out, but the windows mobile docs for phonegap are awful. As of Phonegap 3.0, heres what it still says on the windows platform guide: Download and extract the ...

Show Detail

PhoneGap Windows Phone app native browser?

I am about to develop a PhoneGap Windows-Phone app, since i know PhoneGap uses the native browser of the phone to display the app, i would be happy if someone can clarify the following questions fo...

Show Detail

Issue on deploying phonegap build directly to windows phone

Iam doing a phonegap project now, i have deployed my app to many android devices, all works fine. Started on windows phone &amp; i found here phonegap apps cant deploy directly to windows phone. I ...

Show Detail

A phonegap-like for windows phone

I have a mobile web app (HTML &amp; CSS). I use Phonegap to embed it for Android, iOS, BB, etc, but it doesn't work for windows mobile for the moment. Is there a way doing that in windows phone, o...

Show Detail