PHP / Javascript: Cross-domain JSON request issues

I am trying to request JSON from Google Places API, but I am still getting the cross-domain request error after firstly including:

header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: POST, GET");
header("Access-Control-Allow-Headers: x-requested-with");

The JSON request I am using is standard JQuery:

function load() {
    var url = '';
    $.ajax(url, {
       async:   true,
       success: function(data, textStatus, jqXHR) {

I would use a JSONP query instead, but the Google Places API doesn’t support JSONP…how can I solve this? With a proxy server?



Leave a comment