Json-in-script - can't get results!

Discussion in 'Google API' started by rossrossp, Nov 14, 2011.

  1. #1
    Dear all,
    I think this may be the wrong forum but cannot find one for the Places API, so apologies.

    I'm having a problem trying to dowload Places information via json-in script.
    This code (taken from the google documentation (http://code.google.com/apis/gdata/docs/json.html)) works for me:

    <script type ="text/javascript">
    function testthis(source){
    alert("the test worked");
    }
    </script>

    <script src="http://www.google.com/calendar/feeds/developer-calendar*at sign*google.com/public/full?alt=json-in-script&callback=listEvents">
    </script>
    (please replace *at sign* with an @.
    However when I swap the code to a Places search, the code doesn't work:

    <script type ="text/javascript">
    function testthis(source){
    alert("the test worked");
    }
    </script>

    <script src="https://maps.googleapis.com/maps/api/place/search/alt=json-in-script?location=51.1814267,-0.0201796&radius=1000&types=food&sensor=false&key=AIzaSyA79UbGT0q1TxYnUIZ7A19GW3Nm1TKnqAE&callback=testthis"></script>

    When go to the URL:
    https://maps.googleapis.com/maps/api/place/search/json?location=51.1814267,-0.0201796&radius=1000&types=food&sensor=false&key=AIzaSyA79UbGT0q1TxYnUIZ7A19GW3Nm1TKnqAE&callback=testthis

    I get a JSON results (have highlighted the only change I made), so the problem must lie with the "alt=json-in-script" part, but for the life of me I can't figure out where.

    Can anybody help me please, I would be very very grateful!
     
    rossrossp, Nov 14, 2011 IP