Forum Academy Marketplace Showcase Pricing Features

Use data from the Database in HTML visual elements

Hello! I’m building a custom Google map from an HTML element. I have a Database, each element is a list of places. So I need to send such an element to my HTML box to show markers. Is there any ways to do that?

I need to form a Javascript array of objects based on this data.

05-06-2021 13-17-16


I am not sure this helps your use case, but here it goes in the event it does

Thanx. But for now i need to attach to Gmaps. But plan to move to smth else later
And I’ll go through the topic, it might help in the current case

When I try to insert data like this, I receive completle broken Javascript code:

This is how it looks like in the editor:

upd 1. Not the best solution. If you have commas in the things, it’s gonna ruin the whole process. I guess, you need to split by ", " and regular expression [A-Z]. Because in a normal sentence, after commas only lower-case letter can follow.

So all you need is to do search in quotes marks. Something like this:

The result:

It gives you string with commas. Then you need to create one-dimensional array:

var array = string.split(',');

Then do it as many times as you need to get other data and create your set of object or multi-dimensional arrays.

1 Like