-1

in my angular js controller i have an ajax request which is returning me an object :

var d= $myformdata;
$.ajax({
type: "POST",
url: url,
data:  d,
success: function(message){
console.log(message);
myNavigator.pushPage('confirmation.html', {msg: message} );
$scope.msg =  myNavigator.getCurrentPage().options.msg;
console.log($scope.msg);
}
 });
else{ alert($err_msg); }

i get the response(message) but when i try to push the data to access it on confirmation page it says undefined. it would be pleasure if anyone could help

Abdul Basit
  • 125
  • 1
  • 3
  • 14
  • What is `myNavigator`..? – T J Mar 08 '16 at 13:23
  • mynavigator is the page navigator(onsen ui) and confirmation.html is the page i want to get the response(message) @TJ – Abdul Basit Mar 08 '16 at 13:26
  • We have no idea how your controllers or services work or what confirmation page does or what specifically is undefined. Show all relevant code – charlietfl Mar 08 '16 at 13:37
  • confirmation page just shows the response object iam getting from ajax request @charlietfl – Abdul Basit Mar 08 '16 at 13:38
  • Object {ProviderReservation: "#####", AirReservation: "#####", UniversalLocator: "#####", all_segments: Array[5], pricing: Object…} this is the response iam getting from ajax req. i just want to navigate to the page with the above object to set the view. i hope u get it now – Abdul Basit Mar 08 '16 at 13:39
  • giving negative marks wont stop me from learning finally i solved it myself ;p – Abdul Basit Mar 08 '16 at 14:45

1 Answers1

0

It depends how you accessing the data in the confirmation page, please check the below example.

Controller

$.ajax({
        type: 'GET',
        url: serviceURL+'xxxxxxxx',
        data: {d},
        timeout: 5000,
        success: function (response) {          
            $scope.loading = false;
            $scope.profiledata = JSON.parse(response).data;
            $scope.$apply();
        },      
        error: function (response) {
            $scope.error = true;
            $scope.$apply();
        }
    });

HTML

<div ng-controller="myProfile">
            <div class="profile-card">
                <img src={{profiledata.profile_image_url}} class="profile-image">
                <div class="profile-name">{{profiledata.firstname}} {{profiledata.lastname}}</div>
                <div class="profile-id">{{profiledata.email}}</div>
                <div class="profile-id">{{profiledata.phone}}</div>
            </div>  
        </div>
Rajesh Vishnani
  • 91
  • 1
  • 1
  • 6