【问题标题】:jquery not fully working in wordpressjquery 不能在 wordpress 中完全工作
【发布时间】:2014-05-04 22:48:50
【问题描述】:

这是链接http://carboncreditcapital.com/calculator/

我不明白为什么页面加载时页面返回 json。 当用户在输入字段中输入返回相关机场名称时,它会自动完成

我不知道应该编辑哪些文件以使 jquery 在 wordpress 中正常工作

<?php

?>

<meta charset="utf-8">
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />

<div>
    From
    <div class="textinput">
        <input type="text" id="dept" name="departure" placeholder="City name or aiport code" style="width: 120px">
    </div>
</div>

<div>
    To
<div>
<input type="text" id="dest" placeholder="City name or airport code" style="width: 120px">
    </div>
</div>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="myScript.js"></script>

查询:

jQuery(document).ready(function(){
jQuery('#dept').autocomplete({
        source:'source.php',
        minLength:1,

    }); 


    jQuery('#dest').autocomplete({
        source:'source.php',
        minLength:1,

    }); 
});

【问题讨论】:

    标签: javascript php jquery ajax wordpress


    【解决方案1】:

    在 wordpress 中你需要使用不同版本的 jquery 函数
    启动 DOC 加载选项

    <script type="text/javascript">
    jQuery(document).ready(function($) {
        $('#dept').autocomplete({
             source:'source.php',
             minLength:1
         }); 
    });
    </script>
    

    【讨论】:

    • 谢谢,你知道为什么页面加载时所有的json数据都会自动显示在页面上吗?数据应该在触发后返回。
    • 请给我们触发器的代码来回答这个问题,user3371790
    • 自动完成 jquery 应该是触发器。
    猜你喜欢
    • 2011-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-29
    • 1970-01-01
    相关资源
    最近更新 更多