Get data from server using webservice in ionic


#1

how i will get data using webservice in ionic.please help me where im wrong.please provide any sample example
this is my code

profils.html

{{profilelist.CustomerName}}

controller.js

.controller(‘ProfilesCtrl’, function ($scope, Profiles, $http) {
//$scope.profiles = Profiles.all();
//Profiles.all().success(function (response) {
$scope.GetStates = function () {
$scope.States = [];
//var params = { ‘screenCode’: $scope.screenCode, ‘Id’: Id };
//var url = “…/Default.asmx/GetStates”;

    var url = "http://server3/mansha/naturals/BookingScheduler.asmx/GetBookings";
    $http.get(url).success(function (data, status, headers, config) {
        if (data != "") {
            var d = JSON.parse(data);
            $scope.States = JSON.parse(d);
            return data;
        }
    });
}
$scope.GetStates();

})


#2

url not hitting and it showing data and params is not defined


#3

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.