A
A
Alexander Andreev2018-08-16 11:56:13
JavaScript
Alexander Andreev, 2018-08-16 11:56:13

Is it possible to load ajax data for a marker on a Google/Yandex map on click?

The company has 6000+ partners. In the "Contacts" section, a google map with all these partners is displayed. To draw markers on the map, in addition to coordinates, information about the partner is loaded (name, phone numbers, mail, address, etc.). As a result, the JSON that contains all this data weighs more than 7 megabytes! This has a very negative effect on page loading.
The question is, is it possible to pull up data on a click on the marker via ajax? Those. lighten json, leave only partner id and coordinates. Then the user clicks on the marker, an ajax request is made to a separate php script that returns data on the partner id passed. And after the answer, the user sees pop-up information on the map, i.e. this is joxi.ru/xAeGjqBtpWqBlm .

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-08-16
@maler1988

Can. There is an example of the corresponding code for Yandex.Maps. For Google, it will be essentially the same - a handler for clicking on a marker, opening an InfoWindow when data is received, setting the content using the setContent method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question