0

我的房地产网站包含来自第三方服务器的 mls/idx 数据。jQuery 函数在我自己的网站上运行良好,但无论何时在 mls/idx 页面上,jQuery 调用都不起作用。在 idx 页面上,以下是 jQuery 库的包含方式:

....    
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js?ver=3.5.1'></script>
<script type="text/javascript">
   var jq = $.noConflict();
</script>

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js'></script></head>
....

以下是元素的定义和 jQuery 调用方式:

<select id="select_agent_id" name="select_agent_id">
    <option value="cw123">C.W.</option>
    <option value="ds123" selected="selected">D.S.</option>
    <option value="jl456">J.L.</option>
</select>


<script language="javascript" type="text/javascript">
jq(document).ready(function() {
    jq("#select_agent_id").change(function() {
        jq.getJSON("http://mysite.com/wp-content/themes/mytheme/get_agent_info.php", {"agent_id" : jq(this).val()}, function(agent,status) {
            jq("#first_name").html(agent.first_name);
            jq("#last_name").html(agent.last_name);
            jq("#agent_title").html(agent.agent_title);
            ....
        });
    });
});
</script>

有人可以帮我找出问题所在吗?第 3 方 idx 提供商根本没有帮助。非常感谢!

4

1 回答 1

1

只包括

回调=?

作为 URL 中的参数。这会将调用转换为进行跨域调用所必需的 JSONP。

更多信息:http ://api.jquery.com/jQuery.getJSON/

于 2013-04-25T21:10:17.973 回答