2014-04-08 60 views
-2

我想设置jQuery的即时邮政编码搜索功能[来自http://ideal-postcodes.co.uk],我成功地添加域http://www.avada.creativeitechnologies.com/wp-content/themes/Avada/examples/example.html上的字段,但邮政编码字段没有显示出来。如果我将这些文件移动到完全不同的域[http://creativeitechnologies.com/test/examples/example.html],那么该页面正常工作。我相信这是jquery相互冲突的问题,但不能正确解决。jquery与其他jQuery的功能冲突在WordPress/PHP

任何帮助表示赞赏。

+0

你试过[jQuery.noConflict(https://开头的API .jquery.com/jQuery.noConflict /)? – MaiKaY

+0

jquery未定义“http://www.avada.creativeitechnologies.com/wp-content/themes/Avada/libs/jquery/jquery.js” – wpdaniel

回答

1

原因是一些文件没有加载

<script src="http://www.avada.creativeitechnologies.com/wp-content/themes/Avada/libs/jquery/jquery.js"></script>// This file not loaded 
    <script src="http://www.avada.creativeitechnologies.com/wp-content/themes/Avada/src/jquery.postcodes.js"></script> // This file loading 
    <script src="http://www.avada.creativeitechnologies.com/wp-includes/js/jquery/jquery.js"></script> // This file loading 

改变文件的顺序(jQuery是第一个)

<script src="http://www.avada.creativeitechnologies.com/wp-includes/js/jquery/jquery.js"></script> 
<script src="http://www.avada.creativeitechnologies.com/wp-content/themes/Avada/src/jquery.postcodes.js"></script>