I have an AJAX.
   var id = "some_text";
   $.ajax({
        type        : "GET",  
        dataType    : "json",
        url         : "<?php echo site_url('con_atk/get_outlet'); ?>",  
        async       : false,
        success     : function(outlet){
           $.map(outlet, function (v) { 
              if(v.NamaOutlet == id){
                window.location.href = "page_a.php";
              }
              else{
                window.location.href = "page_b.php"; 
              }
           })
        }   
})
I'd like to check if the value of id is exist in the AJAX success call (JSON object type). If it exists, redirect to page A and if not redirect to page B. When I use alert on v.NamaOutlet the value is exist. But why am I not redirected to page_a.php?
edit
when I use alert(JSON.stringify(outlet));
[{"KodeOutlet_iBSM":"ACG","NamaOutlet":"Accounting"},{"KodeOutlet_iBSM":"BBG","NamaOutlet":"Business Banking"},{"KodeOutlet_iBSM":"CB I","NamaOutlet":"Corporate Banking I"},{"KodeOutlet_iBSM":"CB II","NamaOutlet":"Corporate Banking II"},{"KodeOutlet_iBSM":"CBT","NamaOutlet":"Corporate & Branch Transformation"},{"KodeOutlet_iBSM":"CCG","NamaOutlet":"Culture & Customer Care"},{"KodeOutlet_iBSM":"CHG","NamaOutlet":"Consumer Finance & Hajj"},{"KodeOutlet_iBSM":"CMG","NamaOutlet":"Commercial Banking"}
 
     
     
     
     
     
    