Welcome to the part 2 🙂 (in case you didn’t read the first part please go back, read it and return here)!
Now we will write the first pieces of code, so let’s start ….
Open your HTML editor and insert the code below into the HEAD section (between <head> and </head>) :
Don’t forget to replace YOUR_API_KEY with your real API key, if you don’t do this the script will raise an error : “Error : 9902 – There was a problem with your referer/key combination”.
Now, on the BODY section (between <body> and </body>) insert a DIV tag (the map will be drawn there) :
We must follow some simple rules :
- Create an MQMap object – it will store our map. As a parameter we must write the ID of the DIV tag where we want the map to appear.
- Create an MQLocation object – it will tell the main server details about which map to show. You can set the address, city, state, zip code, country using the following functions :
- Call the getMap function of the MQMap object
Here is an example of all from this tutorial :
Basic Map With Points
You can see a working demo here.
I hope you liked this small tutorial 😀