向外部域的请求

I want to make a request to external domain, parameter is sent correctely to php file (on external server) but "request.responseText" allways empty,

thanks in advance (an example will be very apreciate)

<script type="text/javascript">
  function get_XmlHttp() {

    var xmlHttp = null;
    if(window.XMLHttpRequest) {        // for Forefox, IE7+, Opera, Safari, ...
      xmlHttp = new XMLHttpRequest();
    }
    else if(window.ActiveXObject) {    // for Internet Explorer 5 or 6
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    return xmlHttp;
  }

  function ajaxrequest() {
    var request =  get_XmlHttp();        // call the function for the XMLHttpRequest instance


    var  url = 'http://www.mydomain.fr/connexion.php?term=3334';

    request.open("GET", url, true);            // define the request
    request.send(null);        // sends data


    request.onreadystatechange = function() {
      if (request.readyState == 4) {
          //response allways empty
        document.getElementById("context").innerHTML = request.responseText;
      }
    }
  }


    window.onload = ajaxrequest();
  </script>

  <div id="context"></div> 

by default you cannot just load data from another server, however if the server is configured to allow cross origin requests then you'll be good to go.

Take a read through the info here

http://www.html5rocks.com/en/tutorials/cors/