下面的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