jQuery json调用不能在mls/idx页面上工作



我的房地产网站整合了第三方服务器的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>

谁能帮我看看是怎么回事?第三方idx提供商一点帮助都没有。非常感谢!

只包含

调= ?

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

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

最新更新