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

  • Home
  • SEARCH
  • 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 1050019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:42:25+00:00 2026-05-16T16:42:25+00:00

I have xml file that contains the URLs for geocoding requests to Google. I

  • 0

I have xml file that contains the URLs for geocoding requests to Google. I want to iterate through the file, grab the URL (and later the site name…one step at a time), and send a Geocoding request to Google to get the lat and lng from the response. I am having problems with my $.ajax GET request. Can’t the URL parameter just be a value in the array that contains my links? See my code below. Thank you for your help!

$(document).ready(
  function() {

    $locArray = new Array();
    $coorsArray = new Array();

    $.ajax({
        type: 'GET',
        url: 'data.xml', 
        dataType: 'xml',
        success: function(d){


            $(d).find('record').each(function(){

                var $record = $(this);
                var site = $record.find('site_name').text();
                var $maplink = $record.find('maplink').text();


                $locArray.push($maplink);           

             })

             $($locArray).each(
               function() {
                 $.ajax({
                    type: 'GET',
                    url: this,
                    dataType: 'xml',
                    success: function(d) {
                        $(d).find('location').each(function() {
                            var $location = $(this);
                            var $latcoor = $location.find('lat').text();
                            var $longcoor = $location.find('lng').text();
                            var $fullcoors = $latcoor + ", " + $longcoor;

                            console.log($latcoor);

                            $coorsArray.push($fullcoors);
                            //console.log($coorsArray);

                        })

                        $($coorsArray).each(
                          function(){
                            $('ul').append("<li>" + this + "</li>\n");
                          })

                    }
                 })
               }
             ); 



          } 


      });

});
  • 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-16T16:42:26+00:00Added an answer on May 16, 2026 at 4:42 pm

    You cannot initiate an AJAX request to a domain other than your own. This is to prevent XSS attacks. See Same Origin Policy.

    If you want to get data from Google, either setup a proxy on your own domain which mirrors Google’s response or due to request directly on your server.

    Also, since you seem to geocode the same list of URLs, why not simply geocode them and cache the result?

    Google supported JSONP previously but due to abuse, JSONP support was dropped.

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

Sidebar

Related Questions

I have an XML file that contains URLs. I want to add cases because
I have an XML file that contains price value.I want to sort my table
I have an XML file that contains an illegal character, I am iterating through
I have an xml-file that contains data that I want to read. The code
I have an xml file that contains its element like <ab:test>Str</ab:test> When I am
I have an xml file that contains a structure.. In this structure, I have
I have an XML file format that contains a structure of questions: <question id=q101>
I have been provided an XSD and a sample Xml file that contains the
I have generated an XML file that and one of the nodes contains data
For an XML file I am creating I have data that contains a bullet

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.