title: Return JSON to AJAX
body: <p>I use AJAX to call a script php this script will return text in format JSON when i put dataType:'json' my code don't work but when i put dataType:'html' it's work
  there is my code:</p>
  
  <pre><code>$.ajax({
              dataType : 'json',
              url : 'ws_stb_status.php',
              type : 'POST',
              data : {stbInfo:stbInfo},
              success : function(data){
                      $("#StbStatus").html(data);
                      $("#wait").html('');
              }
      });
  </code></pre>
  
  <p>script.php:</p>
  
  <pre><code>$rpi ="http://192.168.1.15";
  if (isset($_POST['stbInfo']))
   {  
  
  if($_POST['stbInfo']=="On")
  {
  
      $url=$rpi.'/StbGetDataModel.php';
      $response = proxy::get($url);
      $url=$rpi.'/upload/datamodel.txt';
      $response = preg_split("/[\r\n\t\f]+/",proxy::get($url));
      $text = '';
      $model = '';
      foreach($response as $pair){
          $res=explode('=',$pair);
          switch($res[0]){
              case 'DeviceInfo.AdditionalSoftwareVersion':
                  $text = $text.'Version Loader,Firmware,AR : '.$res[1].'&lt;br /&gt;';
                  break;
              case 'DeviceInfo.Manufacturer':
                  $text = $text.'Fabriquant : '.$res[1].'&lt;br /&gt;';
                  break;
              case 'DeviceInfo.ModelName':
                  $text = $text.'Mod&amp;#232;le : '.$res[1].'&lt;br /&gt;';
                  $model = $res[1];
                  break;
          }
      }
      $arr['model'] = $model;
      $arr['text'] = $text;
      echo (json_encode($arr));
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Thank you in advance</p>