Javascript Ajax和googleplaceapi获取json
我正在制作一个简单的页面,在这里你可以在一个文本框中输入城市的名称,并显示城市的基本信息(地址、名称等)。我在使用Google Places API时遇到问题。这就是我目前所拥有的 restaurants.htmlJavascript Ajax和googleplaceapi获取json,javascript,ajax,json,google-places-api,Javascript,Ajax,Json,Google Places Api,我正在制作一个简单的页面,在这里你可以在一个文本框中输入城市的名称,并显示城市的基本信息(地址、名称等)。我在使用Google Places API时遇到问题。这就是我目前所拥有的 restaurants.html <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; ch
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Restaurant Search</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="jquery.js"></script>
<script src="functions.js"></script>
<script>
$(document).ready(function(){
getRestaurants();
});
</script>
</head>
<body>
<div class="main">
<form>
Enter city name: <input id="city" type="text" name="cityname"><input id="btn" type="submit" value="Search">
</form>
<div id="error">
The search field cannot be left empty!
</div>
</div>
<div id="header">
</div>
<div id="items">
</div>
</body>
</html>
css中只有这个
#error{
display: none;
}
有什么问题吗?请查看此链接
只需复制代码并根据需要定制即可
#error{
display: none;
}