为什么Google地图没有出现在网站上? [英] Why Google map did not appear on the website?

查看:116
本文介绍了为什么Google地图没有出现在网站上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有google maps api的问题。我需要修复网站上的错误,谷歌地图应该在标准搜索旁边,但它没有出现。我的代码或api没有错。您可以在网站上看到错误:https://pmspk.moe.gov.my/directory/。以下是代码:



Hello, I have issue with google maps api. I need to fix the error in the website where the google map should be there beside the criteria search but it did not appear. I don't what wrong whether the code or the api. You can see the error at the website:https://pmspk.moe.gov.my/directory/ . Below is the code:

<!DOCTYPE html>
<!--[if lt IE 9]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.9.0.min.js"></script>
<script src="https://maps.google.com/maps/api/js?key=AIzaSyBJdW-MjFSmTRwAMv8l2_fQT-LxRiepR6s&libraries=geometry&?1343675510"></script>
<script type="text/javascript" src="js/maplace.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.9.1/themes/smoothness/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.9.1/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
	/*
	$('#controls').on('change', function() {
	  showGroup(this.value);//alert(  ); // or $(this).val()
	});
	$('#negeri').on('change', function() {
	  showGroupState(this.value);//alert(  ); // or $(this).val()
	});
*/
var maplace = new Maplace({
	map_div: '#gmap-mixed',
	controls_div: '#searchSekolah',
	controls_type: 'dropdown',
	controls_on_map: true
});

/*
function showGroup(index) {
	$.getJSON('data/ajax.php', { view:'sekolah', type: index  }, function(data) {
		maplace.Load({
			locations: data.points,
			view_all_text: data.title,
			type: data.type,
        	force_generate_controls: true,
        	map_options: {
		        zoom: 1
		      }
		});
	});
}

function showGroupState(index) {
	$.getJSON('data/ajax.php', { view:'negeri', type: index }, function(data) {
		maplace.Load({
			locations: data.points,
			view_all_text: data.title,
			type: data.type,
        	force_generate_controls: true,
        	map_options: {
		        zoom: 1
		      }
		});
	});
}
*/
function showGroupNew(i,j) {
	$.getJSON('data/ajax.php', { view:i, type: j }, function(data) {
		if(data.title == 'No entries found'){
			alert('no entries found');
			maplace.Load({
				locations: [
							{
			        lat: '3.463926',
			        lon: '107.528700',
			        //title: 'Title',
			        //html: 'Content',
			        zoom: 6,
			        //animation: google.maps.Animation.DROP
			    }],
				show_markers: false,
				view_all: false,
	        	map_options: {
			        zoom: 1
			      }
			});
		} else {
			maplace.Load({
				locations: data.points,
				view_all_text: data.title,
				show_markers: true,
				type: data.type,
	        	force_generate_controls: true,
	        	map_options: {
			        zoom: 6
			      }
			});
		}
		
	});
}

function showOne(index) {
	//alert(index);
	$.getJSON('data/search.php', { namasekolah:index }, function(data) {
		//alert(data.sql);
		maplace.Load({
			locations: data.points,
			view_all_text: data.title,
			type: data.type,
        	force_generate_controls: true,
        	map_options: {
		        zoom: 12
		      }
		});
	});
}
//showGroup(1);
showGroupNew('2', 'WP PUTRAJAYA');


	var availableTags =  <?echo json_encode($data)?>;

	$( "#searchSekolah" ).submit(function( event ) {

  		showGroupNew($( "#controls" ).val(), $( "#negeri" ).val());
  		event.preventDefault();
	});
	$( "#searchSekolah2" ).submit(function( event ) {

  		showOne($( "#institutionName" ).val());
  		event.preventDefault();
	});

	$( "#institutionName" ).autocomplete({
      source: availableTags
      
    });
});


</script>
<style>
.gmap-mixed{width: 100%; height: 490px;}
.gmap_controls{visibility: hidden;}
table{border:0; width: 100%; margin: 0; padding: 0}
body{padding: 0; margin: 0}
.searcharea{padding:10px;}
.ui-autocomplete-loading {
    background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat;
  }
</style>

<?
	if($_GET["lang"]==""){
		$jenisInstitusi = "Jenis Institusi";
		$preschool = "Pra Sekolah";
		$primaryschool = "Sekolah Rendah";
		$secondaryschool = "Sekolah Menengah";

		$negeri = "Negeri";

		$search = "Cari";

		$or  = "Atau";

		$institutionname = "Nama Institusi";
	} else {
		$jenisInstitusi = "Institution Type";
		$preschool = "Preschool";
		$primaryschool = "Primary School";
		$secondaryschool = "Secondary School";

		$negeri = "State";

		$search = "Search";

		$or  = "Or";

		$institutionname = "Institution Name";
	}
	
?>

</head>
<body>
<table cellspacing="0" cellpadding="0">
<tr><td width="25%" valign="top" class="searcharea">
<form id="searchSekolah">
<? echo $jenisInstitusi?>:<br />
<select id="controls">
	<option value="1"><? echo $preschool?></option>
	<option value="2"><? echo $primaryschool?></option>
	<option value="3"><? echo $secondaryschool?></option>
</select>
<br /><br />
<? echo $negeri?>:<br />
<select id="negeri">
	<option value="KELANTAN">Kelantan</option>
	<option value="SABAH">Sabah</option>
	<option value="WP KUALA LUMPUR">Wilayah Persekutuan (Kuala Lumpur)</option>
	<option value="PERLIS">Perlis</option>
	<option value="SARAWAK">Sarawak</option>
	<option value="MELAKA">Melaka</option>
	<option value="Terengganu">Terengganu</option>
	<option value="SELANGOR">Selangor</option>
	<option value="KEDAH">Kedah</option>
	<option value="PAHANG">Pahang</option>
	<option value="PERAK">Perak</option>
	<option value="WP PUTRAJAYA">Wilayah Persekutuan (Putrajaya)</option>
	<option value="PULAU PINANG">Pulau Pinang</option>
	<option value="NEGERI SEMBILAN">Negeri Sembilan</option>
	<option value="JOHOR">Johor</option>
	<option value="PULAU PINANG">Pulau Pinang</option>
	
</select>
<br />
<input type="submit" value="<? echo $search?>" />
</form>
<br />
<? echo $or?>,
<br /><br />
<form id="searchSekolah2">

<? echo $institutionname?> :<br />

<input id="institutionName">
<input type="submit" value="<? echo $search?>" />


</form>
</td>
<td><div class="gmap-mixed" id="gmap-mixed"></div></td></tr>
</table>


</body>
</html>





我尝试过:



- 我更新了谷歌地图api版本



What I have tried:

- I have update the google maps api version

推荐答案

(文件).ready(function(){
/ *
(document).ready(function() { /*


('#controls')。on('change',function(){
showGroup(this.value); // alert(); //或
('#controls').on('change', function() { showGroup(this.value);//alert( ); // or


(this).val()
});
(this).val() });


这篇关于为什么Google地图没有出现在网站上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆