0

So, I'm basically trying to load data from my database. However, I don't know where to start.

Here's what I'm trying to accomplish:

  1. Load mySQL data using php
  2. store data to php array
  3. pass php array to javascript using json_encode()

Do you think it's a good approach? If not, what else can I do? Here's an example of a static javascript array - the whole point is to change this into making it dynamic so I can easily add to this javascript array by loading data to the database.

    var
    mapObject,
    markers = [],
    markersData = {
        'Shop': [
        {
            name: 'Shopping Mall',
            map_image_url: 'img/img.png',
            name_point: 'EMAAR',
            description_point: 'Lorem Ipsum',
            url_point: '02.html'
        },
        {
            name: 'Manly Beach',
            map_image_url: 'img/img4.png',
            name_point: 'Some Group, LLC',
            description_point: 'Shop at the beach!',
            url_point: '02.html'
        }
        ],

        'Park': [
        {
            name: 'Our Beach Park',
            map_image_url: 'img/img2.png',
            name_point: 'My Group',
            description_point: 'Lorem Ipsum',
            url_point: '02.html'
        }
        ]
    };

So, how do I begin by approaching this problem? My knowledge in such cases is limited.

Hakam
  • 39
  • 9
  • 2
    That certainly sounds like a reasonable approach. What happened when you *tried*? – David Nov 22 '15 at 13:41
  • I'm looking to give it the best approach. Thus, I haven't tried anything yet and I'm also quiet new to js so I need something to give me a kickstart. @David – Hakam Nov 22 '15 at 13:45
  • Well, we're happy to help with any questions or problems you encounter while developing this. But what you seem to be describing is that you're looking for some source of motivation to get started. I don't see how we can really provide that. – David Nov 22 '15 at 13:48

0 Answers0