下面的jQuery获取包含地址html表的部分视图。然后使用jqModal来显示地址,并使用鼠标悬停来突出显示地址。这在我的本地机器上正常工作。当我尝试从服务器(Win 2008,IIS 7)运行它时,地址显示在jqModal中,但Higlightlight无法正常工作。此外,从服务器浏览时,这工作正常。奇怪的jQuery问题
<script>
$(document).ready(function() {
$("#Search").click(function() {
displayAddressList();
});
$('#dialog').jqm();
});
function displayAddressList() {
var PostCode = $("#tbSearch").val();
var url = '<%= Url.Action("AddressSearch", "Addresses")%>';
$.get(url, { PostCode: PostCode }, function(data) {
$("#dialog").html(data);
$('table#data_table tr').mouseover(function() {
$(this).addClass('selectedRow');
}).mouseout(function() {
$(this).removeClass('selectedRow');
});
});
}
</script>
<style>
.selectedRow {
background-color: white;
cursor: pointer;
}
</style>
<div class="jqmWindow" id="dialog">
<a href="#" class="jqmClose">Close</a>
</div>
看起来像只有当主机是本地主机...... AJAX请求是否实际执行? – 2009-06-17 08:57:20
那么当它被发送到客户端时,<%= Url.Action(“AddressSearch”,“Addresses”)%>呈现给什么人呢?您的应用没有运行在现场网站上的虚拟目录中? – Charlino 2009-06-17 10:08:44
创建地址html表的部分视图 – Danny 2009-06-17 15:52:09