title: get html via jsonp
body: <p>I use the code below to get to an HTML page</p>
  
  <pre><code>&lt;html&gt;&lt;head&gt;&lt;title&gt;jsonp test&lt;/title&gt;
  &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;&lt;body&gt;
  
  &lt;script type="text/javascript"&gt;
  $(document).ready(function() {
      var url =  "http://www.yahoo.com";
      $.getJSON(url,null,function(data,status,xhr) {
  
          alert(data+" "+status+" "+xhr);
  
          });     
  });
  &lt;/script&gt;
  &lt;/body&gt;&lt;/html&gt; 
  </code></pre>
  
  <p>but <strong>data</strong> always returns null
  Why?</p>
  
  <p><strong>Updated question:</strong></p>
  
  <p>refer to yahoo's method descrided at
  <a href="http://developer.yahoo.com/javascript/howto-proxy.html" rel="nofollow">http://developer.yahoo.com/javascript/howto-proxy.html</a> </p>
  
  <p><strong>php_proxy_simple.php</strong>
      
  
  <pre><code>// Allowed hostname (api.local and api.travel are also possible here)
  define ('HOSTNAME', 'http://www.google.com/');
  //define ('HOSTNAME', 'http://search.yahooapis.com/');
  
  // Get the REST call path from the AJAX application
  // Is it a POST or a GET?
  $path = ($_POST['yws_path']) ? $_POST['yws_path'] : $_GET['yws_path'];
  $url = HOSTNAME.$path;
  
  // Open the Curl session
  $session = curl_init($url);
  
  // If it's a POST, put the POST data in the body
  if ($_POST['yws_path']) {
      $postvars = '';
      while ($element = current($_POST)) {
          $postvars .= urlencode(key($_POST)).'='.urlencode($element).'&amp;';
          next($_POST);
      }
      curl_setopt ($session, CURLOPT_POST, true);
      curl_setopt ($session, CURLOPT_POSTFIELDS, $postvars);
  }
  
  // Don't return HTTP headers. Do return the contents of the call
  curl_setopt($session, CURLOPT_HEADER, false);
  curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
  
  // Make the call
  $xml = curl_exec($session);
  
  // The web service returns XML. Set the Content-Type appropriately
  header("Content-Type: text/xml");
  
  echo $xml;
  curl_close($session);
  
  ?&gt;
  </code></pre>
  
  <p>my code to call web proxy php_proxy_simple.php and getthe html code of google.com</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
  function load()
  {
  
     var path = '';
     var url = 'http://www.mysite.com/php_proxy_simple.php?yws_path=' + encodeURIComponent(path);
  
     var xhr = new XMLHttpRequest();
  
     xhr.open('GET', url,true );
     xhr.onreadystatechange = function() {
        if (xhr.readyState == 4  ){     
           alert ("length:"+xhr.responseText.length+xhr.responseText);
        }
     }
     xhr.send();
  
  }
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body onload="load()"&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>xhr.responseText.length always is 0 and xhr.responseText returns null</p>