[英]unable to load google static map into div in jquery mobile
I am trying to load google static map image into div in JQM In firebug i can see the image is getting downloaded. 我正在尝试将Google静态地图图像加载到JQM中的div中。在萤火虫中,我可以看到图像正在下载。 it also shows an error saying illegal character PNG
它还显示了一个错误,指出非法字符PNG
var mapRequestData = "http://maps.googleapis.com/maps/api/staticmap?center=" + locationDetail + "&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7&markers=color:green%7&sensor=false";
$.getJSON(mapRequestData + "&callback=?", function (data) {
$('#map').html('<img src="data:image/png;base64,' + data + '" />');
$("#map").page();
});
Any help of suggestion much appreciated. 任何建议的帮助,不胜感激。
尝试
$('#map').html('<img src="'+mapRequestData+'"/>');
Thanks Nauphal I had solved the same by applying following code 谢谢Nauphal我已经通过应用以下代码解决了同样的问题
var mapRequestData = " http://maps.googleapis.com/maps/api/staticmap?center= " + locationDetail + "&zoom=9&size=400x300&maptype=roadmap&markers=color:blue%7&markers=color:green%7&sensor=false"; var mapRequestData =“ http://maps.googleapis.com/maps/api/staticmap?center= ” + locationDetail +“&zoom = 9&size = 400x300&maptype = roadmap&markers = color:blue%7&markers = color:green%7&sensor = false”;
$(".mapImage").attr('src', mapRequestData); $(“。mapImage”)。attr('src',mapRequestData);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.