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 8004279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:52:18+00:00 2026-06-04T16:52:18+00:00

I want to get Javascript data in another page and use it in an

  • 0

I want to get Javascript data in another page and use it in an existing javascript.

Let me explain it with the codes.

I want to get this data from that other page

   <script type="text/javascript">
      var data = {
  "users": [
    {
      "latitude": "48.405163",
      "longitude": "2.684659"
    },
    {
      "latitude": "43.7347242529278",
      "longitude": "7.42198348045349"
    }
  ]
};
    </script> 

I tried to get it it using this code

    $(function MapData() {
        $.getScript({
            type: "GET",
            url: "default.cs.asp?Process=ViewCheckinMap",
            success: function(data) {
                $("#content").append(data);
            },
            error: function (data) {
                $("#content").append(data);
            }
        });
    });

In order to use data inside the data variable it in this code

  function initialize() {
    var center = new google.maps.LatLng(48.404840395764175, 2.6845264434814453);

    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 3,
      center: center,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });

    var markers = [];
    for (var i = 0; i < data.users.length; i++) {
      var location = data.users[i];
      var latLng = new google.maps.LatLng(location.latitude,
          location.longitude);
      var marker = new google.maps.Marker({
        position: latLng
      });
      markers.push(marker);
    }
    var markerCluster = new MarkerClusterer(map, markers);
  }
  google.maps.event.addDomListener(window, 'load', initialize); 

But I am getting data is not defined error.

I also tried getting data from the other page using

$.getScript('default.cs.asp?Process=ViewCheckinMap');

But I got the same error.

How can I fix this?
Many thanks!

  • 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-06-04T16:52:19+00:00Added an answer on June 4, 2026 at 4:52 pm

    When you’re loading javascript with $.getScript(), you should not include <script> tags in the file you’re loading. Also, you need to run your initialize() function after you’ve finished loading the file:

    $.getScript('default.cs.asp?Process=ViewCheckinMap', initialize)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In javascript, i want to get an element and render it inside other element.
I want to run Protovis javascript from Java and get the evaluated SVG code.
My JavaScript is as follows: $.get(/<page>.php, userid='.$userid.'&+status, function(data){ $(#status).show(fast).html(data).delay(4000).hide(fast); }); I have many links
I want to get the current UTC date with Javascript. How can I do
I want to get a reference to the Gmail Inbox button in Javascript? I
I want get all of the Geom objects that are related to a certain
I want get as much as possible from Redis + Hiredis + libevent. I'm
Let me start of by saying that I am inexperienced with JavaScript. Here is
I have a webpage that makes an ajax call to get some data. That
I've written a simple web page that uses Javascript to control a Quicktime plugin

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.