Jquery地图插件不做任何提交-重定向到"locator.html#"而不是发射形式的行动
Jquery maps plugin does nothing on submit -redirects to "locator.html#" instead of firing form action
我试图使用bjorn Jquery插件:http://www.bjornblog.com/web/jquery-store-locator-plugin
我遵循所有指示,上面写着:
Usage:
Assuming you already have your locations.xml file set up in the current directory and the basic HTML copied from the example index file, the following would be the simplest usage example:
1. Include the css file (you’ll most likely want to make modifications to this beforehand):
<link rel="stylesheet" type="text/css" href="css/map.css">
2. Include jQuery if you don’t have it on your page already (the example below uses the Media Temple CDN but you can load it from wherever you’d like):
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
3. Include the latest version of Handlebars.js (this is now required)
<script src="js/handlebars-1.0.0.min.js"></script>
4. Include Google Maps API. If you want to target a particular country add “®ion=” to the end of the URL followed by the country code.
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
Region targeting example:
<script src="http://maps.google.com/maps/api/js?sensor=false®ion=UK"></script>
5. Include the plugin file:
<script src="js/jquery.storelocator.min.js"></script>
6. Apply the storeLocator plugin to the map-container div.
<script>
$(function() {
$('#map-container').storeLocator();
});
</script>
7. Make sure you have the basic form and map container HTML set up or copied from the example file.
我的HTML如下:注意,我已经包括Jquery,把手和一切。我在与我的位置详细信息相同的目录中有一个.xml文件(我应该这样做)。
定位器显示正确(至少表单),我的问题是,每当我试图搜索位置,点击提交按钮,我的页面只是重定向到"定位器。html#",而不是搜索它什么也不做。我想这意味着出于某种原因,我的js没有开火?
编辑:**我已经在我的生产服务器上放了一个页面的副本:http://bscserver.com/M2M/locator.html -随时检查它,你会看到我的意思
与此工作版本比较:http://bjornblog.com/storelocator/
帮助吗?提示?谢谢!
下面的Html。
<!DOCTYPE html>
<html>
<head>
<title>Map Example - Auto geocoding</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/map.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="js/handlebars-v1.3.0.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="js/jquery.storelocator.js"></script>
</head>
<body>
<div class="container">
<div class="sidestripLeft"></div>
<div class="sidestripRight"></div>
<div class="mainHeader">
<div class="spacerBox"><div id="box1"></div><div id="box2"></div></div>
<div class="logoBlock">
<img src="Img/M2M_logo.jpg"/>
</div>
</div>
<div class="mainBody">
<div class="mainSidebar">
<article class="navBox">
<nav><ul>
<li class="active"> <a href="0">STORE LOCATOR</a></li>
<li> <a href="0">TALK TO US</a></li>
<li> <a href="0">CAREERS</a></li>
</ul></nav>
</article>
</div>
<div class="mainContent">
<div id="store-locator-container">
<div id="page-header">
<h1>Using Chipotle as an Example</h1>
<p>I used locations around Minneapolis and the southwest suburbs. So, for example, Edina, Plymouth, Eden Prarie, etc. would be good for testing the functionality.
You can use just the city as the address - ex: Edina, MN.</p>
</div>
<div id="form-container">
<form id="user-location" method="post" action="#">
<div id="form-input">
<label for="address">Enter Address or Zip Code:</label>
<input type="text" id="address" name="address" />
</div>
<button id="submit" type="submit">Submit</button>
</form>
</div>
<div id="map-container">
<div id="loc-list">
<ul id="list"></ul>
</div>
<div id="map"></div>
</div>
</div>
</div>
</div>
<div class="mainFooter">
<div id="shadowLine"></div>
<div id="footerArea">Copyright © 2014 Man To Man Pty Ltd. All Rights Reserved. Designed by Bond Street Conversation Pty Ltd.</div>
</div>
<script>
$(function() {
$('#map-container').storeLocator();
});
</script>
</body>
</html>
我通过在Chrome上使用firebug lite和反复试验找到了这个问题的原因。
代码本身似乎没有什么问题,尽管原因是无法在我的本地机器上工作(由于某种原因它可以在WAMP上工作),尽管我也调用了不受支持的Jquery版本。看起来插件更新了,但文档没有。因此,通过遵循文档,我实现了过时的包括。我把这个留在这里,以防将来有人有类似的问题与Jquery插件!
相关文章:
- 铬:“;未捕获的语法错误:意外的标记:"
- 可以设置“;文件名"发生错误时显示的内联脚本标记的
- JS表单提交"无法使用Chrome数据保护程序加载此页面.尝试重新加载页面.调试信息:POST CISmtuK
- 检测电话窃听,即:<a href="电话:xxx">在UIWebview上
- NodeJS-readline暂停和恢复事件发射器(逐行读取)
- 使用“+="操作人员
- //而不是在src=“”上使用http://"属性
- "未捕获的语法错误:意外的标记}"
- 多次发射多个可观察器的问题
- 可以<脚本类型=“;text/javascript”>window.location=“/"</
- "实例范围”;TypeScript类的getter/setter
- Javascript复选框函数:;缺少:在属性id之后"
- "“;变量未引用正确的对象
- "日期“;AJAX请求返回的类型值未定义
- 得到"TypeError:无法读取属性'filename'未定义的“;调用“npm start
- Soundcloud api"未捕获的类型错误:无法读取属性'uri'“未定义”;
- "工具提示"jQuery插件坏了
- "锻造;React中的表达式
- 图像可以从源<img src=""/>.TEXT可以在没有javascript的情况下从外部
- webpack挂在""上;95%发射"/"95%发射"