Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6320841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:02:47+00:00 2026-05-24T16:02:47+00:00

I am building an application in which i am trying to fetch the list

  • 0

I am building an application in which i am trying to fetch the list of places near to a given lat and long.

i got a api key and entering this on my browser url works and gives me a json file with the places data.

https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=500&sensor=false&key=AIzaSyAImBQiqvaXOQtqeK8VC-9I96kMmB6Mz7I

but when i try to fetch and parse it though j query its not giving me anything.

$(document).ready(function(){
$.getJSON('https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=500&sensor=false&key=AIzaSyAImBQiqvaXOQtqeK8VC-9I96kMmB6Mz7I',
 function(data) {
  alert(data);
});

i found the following questions on stack overflow but they dint reach me to an answer.

parse google place json with javascript

How do I use Google Places to get an array of Place names?

EDIT:

i tried to get contents of the file using php by

echo file_get_contents("https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=500&sensor=false&key=AIzaSyAImBQiqvaXOQtqeK8VC-9I96kMmB6Mz7I");

and got the file contents using php.

But is there a way to parse this with jquery or javascript ?

Thank you for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:02:48+00:00Added an answer on May 24, 2026 at 4:02 pm

    It’s not possible using ajax (directly) cross domain request are not allowed. I’ve tried:

    echo file_get_contents("https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=500&sensor=false&key=AIzaSyAImBQiqvaXOQtqeK8VC-9I96kMmB6Mz7I");
    

    it works for me (wamp 2.0 openssl enabled).

    if you succeed in this, you can get the content using your ajax script on the page in the same domain.

    EDIT:

    The idea is to do an ajax call to your php page, the php page gets data from de google api and returns it. jquery automatically parses json 🙂

    in code:

    $.ajax({
      url: 'url_to_your_php',
      data: {
        location:'-33.8670522,151.1957362',
        radius:500,
        sensor:false,
        key:'AIzaSyAImBQiqvaXOQtqeK8VC-9I96kMmB6Mz7I'},
      dataType: "json"
      type: "GET", //or POST if you want => update your php in that case
      success: function( data ) {
        for(var i in data.results){
           doSomthingWithYourLocation(data.results[i]);
        }
      },
      error: function (request, status, error) {
        //handle errors
      }
    });
    

    Your php shoud do somthing like this:

    <?php 
        header('Content-type: application/json');
        echo file_get_contents("https://maps.googleapis.com/maps/api/place/search/json?" .
          "location=-" . $_GET['location'] .
          "&radius=" . $_GET['radius'] .
          "&sensor=" . $_GET['sensor'] .
          "&key=" .$_GET['key']);
    ?>
    

    It is probably best to check the input in the php files but this should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building an application which relies on the Google Maps API, but running into
I'm building an application which uses CDI (Weld Container) and @ConversationScope for the views.
I am building an application which stores GPS locations in a SQLite database and
I'm building an application which will be able to send emails at any specific
I'm building an MVC application which uses Windows Authentication. I want to handle a
i'm building an android application which have a chat. in this chat i each
I'm building a C# application which uses plug-ins. The application must guarantee to the
I'm building a java application which works in a LAN environment, every computer on
I am building a Monotouch application which downloads data from the server encrypted using
I'm building a delphi application which does scientific simulation. It's growing in complexity &

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.