title: JSON return empty response on FireFox & Safari (Windows Vista)
body: <p>SOLVED: </p>
  
  <p>The problem lies within Firefox 6.0.2 security.
  I have changed my URL request from:
  <a href="http://mysite.com/ajax/request" rel="nofollow">http://mysite.com/ajax/request</a>
  to /ajax/request
  and Its working.</p>
  
  <p>If you need to use cross domains, you need to use jsonp as your dataType.</p>
  
  <p>Many thanks to evildead</p>
  
  <hr>
  
  <p>My JSON request to my server returns an empty response. 
  This only happens in Firefox 6.0.2 and Safari in a Windows Vista machine.</p>
  
  <p>The output is generated by a php script and has json/application headers.</p>
  
  <p>This returns empty response:</p>
  
  <pre><code>    $('#ajaxcall').click(function(){
  var ts = new Date().getTime();
  var urlz = $('#targeturl').val()+'/'+ts;
  var dataString = $("#datazz").val();
  $.ajax({  
      type: "POST", url: urlz, data: "data="+dataString, 
      success: function(data){  
          var obj = jQuery.parseJSON(data);
  
          for (var i = 0; i &lt; obj.length; i++) {
              var object = obj[i];
              for (property in object) {
              var s = property + "=" + object[property] + "&lt;br&gt;";
                  $("#console").after(s);
              }
          }
      }  
  });
  });
  </code></pre>
  
  <p>As well as this:</p>
  
  <pre><code>$( "#tags" ).autocomplete({
          source: function( request, response ) {
              $.post("http://mysite.com/v2/ajax/tag_suggestion/ab", {data:request.term}, function(data){
                  response($.map(data, function(item) {
  
                  if ($('#tagsboxvals').hasClass(item.name.split(' ').join('_'))){
                  return null;
  
                  } else {
                  return {
                      label: item.name,
                      value: item.name
                  }
                  }
                  }))
              }, "json");
              },
              ....
  });
  </code></pre>
  
  <p>Thanks for your help</p>
  
  <p>Edit: This is what the PHP script is generating:</p>
  
  <pre><code>$arr = array(
      array('name'=&gt;'pizza', 'point'=&gt;'1'),
      array('name'=&gt;'blt', 'point'=&gt;'1'));
  
      header('Cache-Control: no-cache, must-revalidate');
      header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
      header('Content-type: application/json');
      echo json_encode($arr);
  </code></pre>
  
  <p>It's a well formed JSON document.</p>
  
  <p>Headers:
  Response Headers
  Date    Wed, 07 Sep 2011 23:58:42 GMT
  Server  Apache/2.2.3 (CentOS)
  X-Powered-By    PHP/5.1.6
  Expires Mon, 26 Jul 1997 05:00:00 GMT
  Cache-Control   no-cache, must-revalidate
  Pragma  no-cache
  Content-Length  29
  Connection  close
  Content-Type    application/json
  Request Headers
  Host    mysite.com
  User-Agent  Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0) Gecko/20100101 Firefox/6.0
  Accept  application/json, text/javascript, <em>/</em>; q=0.01
  Accept-Language en-us,en;q=0.5
  Accept-Encoding gzip, deflate
  Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Connection  keep-alive
  Content-Type    application/x-www-form-urlencoded; charset=UTF-8
  X-Requested-With    XMLHttpRequest
  Referer <a href="http://mysite.com/v2/user/register" rel="nofollow">http://mysite.com/v2/user/register</a>
  Content-Length  8
  Cookie  city=new york; __utma=100174657.1435105779.1308773648.1314994226.1315368765.113; __utmz=100174657.1315368765.113.98.utmcsr=mysite.com|utmccn=(referral)|utmcmd=referral|utmcct=</p>
  
  <p>Headers    Post    Response    JSON
  Object { name="pizza", point=1}
  [Object { name="pizza", point=1}]</p>
  
  <p>It works fine with chrome on the same machine, but not firefox and safari.</p>