title: how i must using if for this angularjs and php code
body: <p>I want to make one if for doing if array result was success alart somethings in 
  this code: <code>if( data.status == 'success'){</code> is not working!!
  it was with one = but result of one = is alwase 200 , I want to check status array if was success alert ... 
  I testthis code: data.data.statusin other place with just one array and this code work but when i use data.data.status in bottom codes its not working !!
  angularjs function code :</p>
  
  <pre><code>$scope.book = function(){
  
          if( $scope.cabs[$scope.active_cab].intialkm &gt;= $scope.trip_distance) {
              $scope.trip_rate = $scope.cabs[$scope.active_cab].intailrate ;
          }else{
              var init_rate =  $scope.cabs[$scope.active_cab].intailrate ;
  
            var std_rate  =  ( $scope.trip_distance - $scope.cabs[$scope.active_cab].intialkm ) * $scope.cabs[$scope.active_cab].standardrate ;
  
              $scope.trip_rate = round_num( parseFloat(init_rate) + parseFloat(std_rate) );
          }
  
          $rootScope.user_data = JSON.parse( localStorage.getItem('user_data') );         
  
          var link = 'book_cab';
          var post_data = {  
                          'user_name'    : $rootScope.user_data.User_name,
                          'token'          : $rootScope.user_data.token,
                          'transfertype' : "Point to Point Transfer" ,
                          'book_date'    : $scope.book_date ,
                          'pickup_area'  : $scope.start_box.location,
                          'drop_area'    : $scope.end_box.location,
                          'taxi_type'    : $scope.selected_cab.cartype,
                          'km'                     : $scope.trip_distance,
                          'amount'             : $scope.trip_rate 
                       }
  
          WebService.show_loading();  
  
          var promise = WebService.send_data( link,post_data);
  
          promise.then(function(data){  
  
              $ionicLoading.hide();
              if( data.status == 'success'){
                  alertPopup = $ionicPopup.alert({
                      title: '&lt;p class="text-center color-yellow"&gt;'+$filter('langTranslate')("SUCCESS",$rootScope.appConvertedLang['SUCCESS'])+'&lt;/p&gt;',
                      template: '&lt;p class="text-center color-gery"&gt;'+$scope.trip_distance+' KM&lt;/p&gt;'+
                                          '&lt;p class="text-center color-gery"&gt; ₹ '+$scope.trip_rate+'&lt;/p&gt;'
                  });
                  animateMyPop();
              }else{
                  window.alert(response.data);
                  window.alert(response.status);
              }
          });
      }
  </code></pre>
  
  <p>php webservice :</p>
  
  <pre><code>public function book_cab(){
  
      $postdata = file_get_contents("php://input");
      $request = json_decode($postdata);
  
      $request-&gt;uneaque_id = 'CMC'.strtotime(date('m/d/Y H:i:s'));
  
  
  
      $myDate = new DateTime();
      $myDate-&gt;setTimestamp( strtotime( $request-&gt;book_date) );
  
      $time =  $myDate-&gt;format("H");
  
      if( $time &gt;= 22 ||  $time &lt;= 6){
          $request-&gt;timetype = 'night';
      }else{
          $request-&gt;timetype = 'day';
      }
  
      $request-&gt;book_date   =  $myDate-&gt;format("m/d/Y");
      $request-&gt;pickup_time =  $myDate-&gt;format("h:i a");
  
      $request-&gt;token = $this-&gt;extract_token( $request-&gt;token );
      var_dump($request );
      $finresult = array( 'status'  =&gt; 'success',
                                  'message' =&gt; 'Successfully registered',
                                  'code'    =&gt; 'registered' 
                                          );
              print json_encode($finresult);  
      $this-&gt;model_web_service-&gt;book($request);
  
  }
  </code></pre>
  
  <p>and model_web_service:</p>
  
  <pre><code> function book( $request ){
  
        $table = 'bookingdetails';
  
          $insert_data = array(
              'username'    =&gt; $request-&gt;token,
              'uneaque_id'    =&gt; $request-&gt;uneaque_id,
              'purpose'       =&gt; "Point to Point Transfer",
              'pickup_date' =&gt; $request-&gt;book_date,
              'pickup_time' =&gt; $request-&gt;pickup_time,
  
              'drop_area'     =&gt; $request-&gt;drop_area,
              'pickup_area' =&gt; $request-&gt;pickup_area,
  
              'taxi_type'   =&gt; $request-&gt;taxi_type,
              'status'            =&gt; "Booking",
              // 'item_status' =&gt; "Pending",
  
              'timetype'      =&gt; $request-&gt;timetype,
              'amount'          =&gt; $request-&gt;amount,
              'km'                    =&gt; $request-&gt;km
          );
  
              $this-&gt;insert_table($insert_data, $table);                      
   }
  </code></pre>
  
  <p>i want to change if for read php status array (success) 
  plz help me for fixing this code </p>