title: JQuery/JSONP/PHP - Firefox OK, but it doesn't work on Chrome and Opera
body: <p>I have to create a web application using JQuery and PHP with cross-domain AJAX requests. So, I use JSONP to do my request. It works fine on Firefox, but not on Chrome and Opera. </p>
  
  <p>I have one function for executing the request :</p>
  
  <pre><code>function update()
  {
      $.ajax({
          url : url,
          type : "GET",
          dataType: "jsonp",
          crossDomain : true,
          jsonpCallback : "updateCallback",
          async : false, 
          data : {'session_id' : sessionID,'user' : userName },
          error : function (xhr, status, error) {
              alert("Erreur de chargement du fichier '"+url+"' : "+xhr.responseText+" ("+status+" - "+error+")");
          },
          success: function(){
              alert("Success !");
          }
      });
  }
  </code></pre>
  
  <p>This the callback function :</p>
  
  <pre><code>function updateCallback(data)
  {     
      var i = 0;
      var messages = data.messages;
  
      while(i &lt; data.messages.length){  
         appendMessage(data.messages[i]);
         i++;
      }
  
      saveLastMsgID = lastMsgID;
      doUpdate = updateInProgress = false;
  }
  </code></pre>
  
  <p>The PHP script called by the AJAX request :</p>
  
  <pre><code>&lt;?php
  
  /* ... */ 
  
  function sendResponse($messages,$date)
  {
      header('content-type: application/json; charset=utf-8'); 
      header("Access-control-allow-origin: *");
      header ("Access-Control-Allow-Headers: x-requested-with", true);
      header('Access-Control-Allow-Methods: GET,OPTIONS');
  
      $datas = array();
  
      for($i = 0 ; $i &lt; count($messages) ; $i++){
          $msg = $messages[$i];
          $message = null;
          $message-&gt;sender = $msg-&gt;getSender();
          $message-&gt;date = $date;
          $message-&gt;msg = stripslashes($msg-&gt;getContent());
          $message-&gt;carrier = $carrier;
          $datas[] = $message;
      }
      $data-&gt;messages = $datas;
      echo $_GET['callback']. '('. json_encode($data) . ')'; 
  }
  ?&gt;
  </code></pre>
  
  <p>Thanks for your help!</p>