0

I have an ajax call that returns lat and lng data, how could i pass that data to Google Maps js that's another file?

          $.ajax({
            url: url,
            dataType: 'json',
            type: 'post',
            contentType: 'application/json',
            data: JSON.stringify( {
              mydata 
            } ),
            success: function(data){
       >>>>this data response, send it to the another js file<<<<<<
          }

and how can i recive that data from the GM js

Gil
  • 701
  • 1
  • 9
  • 20
  • 2
    Why would you need to pass it to another file? If you have another javascript file included you can call the methods which it exposes with the received data as an argument, if that's what you mean... – Vasil Dininski Oct 10 '16 at 15:50
  • Take a look at http://stackoverflow.com/questions/950087/how-to-include-a-javascript-file-in-another-javascript-file But you'll have to create global variable in your "parent script" and assign to it your data result. Your dynamically loaded .js should use exactly the same name of global variable to access those data. Other way is to call a function with parameter, like Vasil adviced... – aliczab Oct 10 '16 at 17:18

0 Answers0