div.append在IE中不起作用。将数据发送到服务器后,调用loadpartialview以获取最新信息并尝试在名为noticount的div中进行更新。它在调试器打开时会在其他浏览器和IE中更新,但在IE中关闭调试器时不会这样做。
部分在5秒后调用
var count = 0;
function loadPartialView() {
var allIncident = null;
$.ajax({
url: "@Url.Action("LoadIncidentNotification", "AccidentOrDamage")",
type: 'GET',
async: false,
success: function (result) {
allIncident = $.parseJSON(result).allIncidents;
if (allIncident.length > 0) {
count = allIncident.length;
//$('#notiCount').empty();
$('#notificationList').empty();
//$('#notiCount').append(allIncident.length);
$('#notiCount').html(allIncident.length);
}
else {
count = 0;
$('#notiCount').empty();
$('#notificationList').empty();
document.getElementById("overflow").style.overflowY = "unset";
$('#notificationList').empty();
$('#notificationList').append('<li>No New Notification</li>');
}
$.each(allIncident, function (k, v) {
$('#notificationList').append("<li> <a style='text-decoration: none;color: black;font-weight: normal !important; font-style:normal;' href='#' onclick='javascript:showSendClaimPopup1(" + v.Id + ",\"" + v.MobileNumber + "\",\"" + v.ClaimNumber + "\");'>Claim Request From " + v.Driver + "</a></li>");
});
}
});
}
5秒后加载功能的代码
$(function () {
loadPartialView();
window.setInterval("loadPartialView()", 5000);
});
将一些数据发送到服务器
var SaveSendClaimClick1 = function () {
if (!ClaimValidate1()) {
return false;
}
var params = {
Id: $("#txtId1").val(),
ClaimNo: $("#txtClaimNo1").val()
};
params = JSONStringify(params);
$.ajax({
type: "POST",
url: "@Url.Action("SaveSendClaim", "AccidentOrDamage")",
data: params,
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (msg) {
//debugger;
if (msg != null) {
if (msg.id != null) {
if (msg.id == "-1") {
closePopup1($("#divSendClaimPopup1"), true);
jError(msg.msg, 'Error', function () {
//$('.mask1').fadeOut('slow');
//$('.mask').fadeOut('slow');
});
} else if (msg.id == "1") {
closePopup1($("#divSendClaimPopup1"), false);
jInformation(msg.msg, 'Information', function () {
//debugger;
//$('.mask1').fadeOut('slow');
//$('.mask').fadeOut('slow');
});
//reloadGrid();
}
}
}
},
error: function (e) {
jError(e.responseText, 'Error', function () {
//$('.mask1').fadeOut('slow');
//$('.mask').fadeOut('slow');
});
}
}); // $.ajax({
};