-1
我似乎無法弄清楚爲什麼我得到這個錯誤我已經看到了錯誤的解決方案,但沒有人使用AJAX來獲取數據,如果有人可以幫助將是巨大的,這裏的JS:不能使用'in'運算符搜索'長度'
$(document).ready(function() {
function updatetabel() {
console.log("update");
$.ajax({
url: "/main",
type: 'GET',
dataType: "",
cache: false,
success: function(result) {
console.log("succes!");
console.log()
$(".table-hover-cells").remove();
$.each(result, function(index, value) {
console.log("update_tabel");
var content = "<table class=\"table-hover-cells" +
this[0] + "\" id=\"hover-table\">" + "<thead>" + "<tr>" + "<td>" +
this.Name + "</td>" + "<td>" +
this.Description + "</td>" + "<td>" +
this.Status + "</td>" + "<td>" +
this.Date + "</td>" + "</tr>" + "</thead>" + "</table>"
$("inv").append(content);
})
console.log("tabel_update");
},
error: function(result, thrownError) {
console.log("Failure!")
console.log(result)
}
});
}
updatetabel();
setInterval(function() {
updatetabel()
}, 100000);
});
$(document).ready(function() {
$('table tbody tr td').on('hover', function() {
$(this).toggleClass('bg');
});
});
你的代碼中的哪一行會拋出該錯誤? – Terry
任何你將數據類型留空的原因,而不是把'json'? – Keith
哪裏使用'.length'? – Niladri