0
Answer

implement map using mapquest

manu vinayak

manu vinayak

14y
4.8k
1

I used mapquest to implement map on my site.But it is not working.Can anyone help me.Thanks in advance.My code is here.Please give me a solution
<
html>
<body>
<div id='Div1' class='myMap' ></div>
<
script src="http://web.openapi.mapquest.com/oapi/transaction?request=script&key=mjtd%7Clu6t2hu1nu%2Cb2%3Do5-gftwd" type="text/javascript"></script>
<
script language="javascript">
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
var hash = getUrlVars();
alert(hash['Address']); // prints 'bonjour'
alert(hash['city']); // prints 'bonsoir'
alert(hash['state']); // prints 'bonsoir'
alert(hash['zip']); // prints 'bonsoir'
<!-- The DIV to hold the Map itself -->

<!-- Create the base MQMap object and pass in the id of the DIV you want to hold the map -->

var mq = new MQMap("myMap");
var loc1 = new MQLocation();

loc1.setName("Champ Ground Location");
loc1.setAddress(hash['Address']);
loc1.setCity(hash['city']);
loc1.setStateProvince(hash['state']);
loc1.setPostalCode(hash['zip']);
loc1.setIconId("203");
mq.locations.add(loc1);


mq.getMap();

</
script>
</
BODY>
</HTML>