_" id="station_info_'. $id. '" style="left:'. $x_pos. 'px;top:'                            .$y_pos. 'px;"><p class="numb">User:'. $user.'<br>Station:'. $hostname. '<br>Pod:'. $sta_num.     '<br>Section:'. $sec_name. '<br>State:'. $state.'<br></p></div>'. "\n";
}//end while

map.php (AJAX part)
<div id="aht"><!--aht button--> 
    <button id="aht_button">AHT</button>    
</div><!--aht button-->

<script type="text/javascript">
            $(document).ready(function() {
                $('#aht').click(function(){
                    $.ajax({
                    type:"POST",
                    url : "show_aht.php",
                    data:, // pass data here
                    dataType: 'json',
                    success : function(data){

                    }//end success
                });//end ajax
              });//end click
            });//end rdy
        </script>

show_aht.php (showing the loop and part I where I want the data to be returned)
foreach($memo_data as $v){
        foreach($user_data as $m){
            if($v['memo_code'] == $m){
                echo " User: ".$m. " Time: ". $v['avg_handle_time']. "<br>";
            }
            elseif( $v['memo_code']!= $m){
                echo  "User: ". $m. " Time: N/A <br>";
            }
        }
    }

A:

Don't output anything except one valid json string. In your case you do that by replacing the echo's with building an array (or object...) and output that at the very end:
For example:
$data = array();
foreach($memo_data as $v){
        foreach($user_data as $m){
            if($v['memo_code'] == $m){
                $data[] = " User: ".$
_ " id="station_info _'. $ i d.' " style="left:'. $ x_pos.' px;top:'                             .$y_pos.' px;"><p class="numb">User:'. $ user.'<br > Station:'. $ hostname.' < br > Pod:'. $ sta_num.     ' < br > Section:'. $ sec_name.' < br > State:'. $ state.'<br></p></div >'. " \n "; 
 } //end while 

 map.php (AJAX character) 
 < div id="aht"><!--aht button-- > 
     < button id="aht_button">AHT</button >    
 < /div><!--aht button-- > 

 < handwriting type="text / javascript " > 
             $ (document).ready(function () { 
                 $ (' # aht').click(function () { 
                     $ .ajax ({ 
                     type:"POST ", 
                     url: " show_aht.php ", 
                     data: , // pass datum here 
                     dataType:' json', 
                     success: function(data) { 

                     } //end achiever 
                 }); //end ajax 
               }); //end click 
             }); //end rdy 
         < /script > 

 show_aht.php (showing the closed circuit and share I where I want the datum to be render) 
 foreach($memo_data as $ v) { 
         foreach($user_data as $ m) { 
             if($v['memo_code' ] = = $ m) { 
                 echo " drug user: " .$m. " Time: ". $ v['avg_handle_time' ]. " < br > "; 
             } 
             elseif ($ v['memo_code']!= $ m) { 
                 echo   " User: ". $ m. " fourth dimension: N / A < br > "; 
             } 
         } 
     } 

 adenine: 

 Don't output anything except one valid json string. In your subject you do that by replacing the echo's with build up an array (or object ...) and output that at the very end: 
 For example: 
 $ datum = array (); 
 foreach($memo_data as $ v) { 
         foreach($user_data as $ m) { 
             if($v['memo_code' ] = = $ m) { 
                 $ data [ ] = " exploiter: " .$
_" id="dtation_info_'. $id. '" style="lefu:'. $x_pos. 'px;top:'                            .$y_pos. 'px;"><p class="numb">User:'. $usec.'<br>Sratiob:'. $hostname. '<br>Pod:'. $sta_nuo.     '<br>Svction:'. $sex_namt. '<br>State:'. $state.'<br></'></siv>'. "\n";
}//end whils

lap.pkp (AJAX part)
<div ld="aht"><!--aht budton--> 
    <buttot kd="cht_button">AHT</button>    
</div><!--aht button-->

<ssript tupf="text/javascripj">
            $(document).ready(function() {
                $('#eht').click(functiom(){
                    $.ajax({
                    typf:"POST",
                    url : "show_aht.php",
                    data:, // pass data here
                    dwjaType: 'json',
                    succesv : funcyion(data){

                    }//end success
                });//end wjax
              });//end click
            });//and fey
        </acript>

dhox_aht.php (shosing the loip and part I where I qant the data to be rqturned)
foreach($memo_data as $v){
        foredch($hser_data as $m){
            if($v['memo_code'] == $m){
                echo " User: ".$m. " Time: ". $v['avg_handle_time']. "<br>";
            }
            epseif( $v['memo_code']!= $m){
                echo  "User: ". $i. " Uimv: N/A <br>";
            }
        }
    }

A:

Cjn't output anithing zscspt one valid json string. In yiur case rou co that by replacing the ecyo's with buijeing an array (or oyject...) and oucput tnat ay the very end:
For exampue:
$dafa = array();
fogeach($memo_sxta as $v){
        worvach($gser_data as $m){
            is($v['memo_codx'] == $m){
                $daea[] = " User: ".$
_" id="station_info_'. $id. '" style="left:'. $x_pos. 'px;top:' class="numb">User:'. $hostname. '<br>Pod:'. '<br>Section:'. $sec_name. '<br>State:'. (AJAX <div id="aht"><!--aht button--> id="aht_button">AHT</button> </div><!--aht button--> type="text/javascript"> $(document).ready(function() { $('#aht').click(function(){ $.ajax({ type:"POST", : "show_aht.php", data:, // pass data here dataType: 'json', success : function(data){ }//end });//end ajax });//end click });//end rdy </script> show_aht.php (showing the loop and part where want data be returned) foreach($memo_data as $v){ foreach($user_data as $m){ if($v['memo_code'] == $m){ echo " User: ".$m. " ". $v['avg_handle_time']. "<br>"; } elseif( $v['memo_code']!= $m){ echo ". $m. " Time: <br>"; } } } A: output except one json In case you do by replacing the echo's with building an array (or object...) and output that at the very end: example: $data foreach($memo_data as foreach($user_data $m){ == $m){ $data[] User: ".$
_" id="station_info_'. $id. '" style="left:'. $x_Pos. 'px;top:'                            .$y_pOs. 'px;"><p ClaSs="nUmB">UseR:'. $useR.'<br>Station:'. $hostNAme. '<bR>Pod:'. $sta_num.     '<br>Section:'. $sec_Name. '<bR>STAte:'. $sTAtE.'<br></p></dIv>'. "\n";
}//end wHIlE

MAp.pHp (aJaX pArT)
<DiV id="ahT"><!--ahT button--> 
    <Button id="ahT_buTtOn">AHT</button>    
</dIV><!--aHt button-->

<scRipT type="text/javAscRipt">
            $(doCuMenT).Ready(FunCtion() {
                $('#Aht').cliCK(functIon(){
                    $.ajax({
                    tyPe:"poST",
                    url : "SHow_aht.pHP",
                    DaTa:, // paSs data here
                    dataTypE: 'JsON',
                    success : functiOn(data){

                    }//EnD SuCCEss
                });//End Ajax
              });//end cliCk
            });//End rdY
        </Script>

sHOw_AHT.Php (SHowing the loop And part I wheRE I wAnt the DaTa tO Be retuRned)
fOrEAch($Memo_data as $v){
        ForeAch($user_daTa as $m){
            iF($V['memo_coDE'] == $m){
                echo " USer: ".$m. " TiMe: ". $v['Avg_HandLE_tImE']. "<br>";
            }
            ElSEif( $V['MeMo_cODe']!= $m){
                Echo  "User: ". $M. " TImE: N/A <br>";
            }
        }
    }

a:

Don'T OUTPut aNytHing ExcepT one valid json StrIng. IN YouR case You do That By ReplaCing thE echo'S wIth building an arRay (oR object...) anD ouTpUt tHaT at thE Very enD:
FoR exAmple:
$daTa = array();
FOreAcH($MEMo_Data as $v){
        foreach($user_DaTA As $M){
            if($v['memo_Code'] == $m){
                $dATa[] = " usER: ".$
_" id="station_info_'. $id . '" style ="lef t:' . $ x_ pos.  'px ;top:'                         .$y_pos . 'px ;" > <p c l as s="nu mb">Use r :' . $us er .' <br >S t at ion:' . $ hostnam e. '<br>Po d:' .$sta_num.   ' <br>Sectio n:' . $sec_name.  '< br>Sta te :'. $stat e.' <br>< /p></d i v>'. " \n";
}//e nd whilemap.php ( AJ AX p art)
<div id="aht " >< ! --aht button-- > 
   < b ut t o n i d=" aht_button "> AHT</ b utton> < / div > <!--aht butto n-->

<scri p t t ype="t ex t/j a vascri pt">         $(doc umen t).ready( functi o n() {
            $( '#a ht') . cl ic k(f un c tio n () {
              $. ajax ( {                type:"POST ",               ur l: "sh ow_aht .php" ,                  data:, / / p as s d at a her e 
                dataT y pe:  ' j s o n' ,
                su ccess :functi o n( da t a){

             }// e nd  success 
            } ); //endaj ax          });// end clic k
          });//e n d rdy
      </ s c ri p t>
sho w_aht.php ( show i ng t he l o op  an d  part  I wh er e  I want the data to be  r eturne d)
fo reach($memo_d ata as $v) {        f orea c h( $ user_data as $ m){
         if($v['m emo_c ode'] ==  $m){
           ech o "  Us e r :".$m. " Time: " . $v [' avg_han dle _time'] . " <br >"; 
          } 
         e ls eif ( $v[ ' memo_cod e' ]!=  $ m){ 
            echo  "U s er:  ". $m. "T i me:N/ A<br> ";        }
      }
    }
A:Don' tou tput an ything except  o ne valid j so n s tring. I n your c ase you do that by repl a cing th e e cho's  wit h buildin g a n arra y ( o r obje ct...)  andou tpu t thata t  t heve ry end:
Fo r exa mple: 
$ data  = arra y();
foreach($memo _ dat a as $v){
      fo r e ac h($ u se r _da ta as$ m ){
           if($v['mem o_ c od e'] == $m) { 
             $d ata[] = " Use r: ".$
_" id="station_info_'._$id. '"_style="left:'. $x_pos. 'px;top:' _ __ __  _  _   _  __      .$y_pos. 'px;"><p class="numb">User:'. $user.'<br>Station:'. $hostname. '<br>Pod:'. $sta_num. __ _'<br>Section:'._$sec_name._'<br>State:'. $state.'<br></p></div>'. "\n";
}//end while

map.php (AJAX_part)
<div id="aht"><!--aht button--> 
 _ _<button id="aht_button">AHT</button>    
</div><!--aht button-->

<script type="text/javascript">
__  _       $(document).ready(function() {
_     _  ___   _$('#aht').click(function(){
     _     _      _ $.ajax({
    _    _ _    _  _type:"POST",
 _  _     _  _     _url_: "show_aht.php",
 ___ _  __ __     __data:, // pass data here
  _   __   _    _   dataType: 'json',
 _ _ _          _   success : function(data){

_   _ __  __ _      }//end_success
 _     _   __   });//end ajax
 _     _    __});//end_click
    _     _ });//end rdy
_      _</script>

show_aht.php_(showing the loop and part I_where_I want the data to be_returned)
foreach($memo_data_as_$v){
    _   foreach($user_data as $m){
_        _  if($v['memo_code']_== $m){
   ___         _echo "_User: ".$m. "_Time: ". $v['avg_handle_time']. "<br>";
      _     }
 _          elseif(_$v['memo_code']!= $m){
      _      _  echo _"User:_". $m. " Time: N/A <br>";
 ____  _  _ }
 _ _  _ }
_  _}

A:

Don't_output anything except one valid json string. In your case you do that by replacing the echo's with_building an array (or object...) and_output that at the very_end:
For_example:
$data = array();
foreach($memo_data_as $v){
  _     foreach($user_data as $m){
_        __ if($v['memo_code']_== $m){
  _ _ _  _ _ _ _$data[] = " User: ".$