使用Jquery(AJAX)将不同域上的PHP连接到HTML

Trying to receive a response from a PHP which is on a different domain to my HTML:

 $.get('getstate.php', {
                email: $('#game-email').val(),
                country: 'DE',
                lang: lang,
                source: 'promotion'
            }, function (data) {
                console.log(data);
             }); 

In chrome I get this error:

XMLHttpRequest cannot load ..... Origin null is not allowed by Access-Control-Allow-Origin.

What do I need to do to achieve this?

A quick google shows me that this has been answered here many times before... It's not possible with ajax for security reasons, so you will have to either

  1. call another domain from within your PHP script, or
  2. look at JSONP

Try dataType: 'jsonp'
$.get('page.php, {}, callback, "jsonp");

a simple PHP proxy from http://jquery-howto.blogspot.co.uk/2009/04/cross-domain-ajax-querying-with-jquery.html

<?php
// Set your return content type
header('Content-type: application/xml');

// Website url to open
$daurl = 'http://feeds.feedburner.com/jQueryHowto';

// Get that website's content
$handle = fopen($daurl, "r");

// If there is something, read and return
if ($handle) {
    while (!feof($handle)) {
        $buffer = fgets($handle, 4096);
        echo $buffer;
    }
    fclose($handle);
}
?>