Re: [問題] alert( $.ajax )
※ 引述《Qiqi (潑潑)》之銘言:
: → terlin10:只是要給自己看的,就用console.log吧! 02/03 21:20
: 推 mrbigmouth:console.log會在ie8以下出bug...要放上網路前記得砍掉 02/05 06:28
Console.log實在是讓人又愛又恨,IE因為沒有內建Console所以會出錯,
為了解決問題,通常我會在網頁主要的master框架下放上一段JS
var alertFallback = false;
if (typeof console === "undefined" || typeof console.log === "undefined") {
console = {};
if (alertFallback) {
console.log = function (msg) {
alert(msg);
};
console.dir = function (msg) {
alert(msg);
};
} else {
console.log = function () { };
console.dir = function () { };
}
}
這樣一來就可以解決Browser沒有自帶console函式的問題了
其中alertFallback 改成 true的話 console.log 或 .dir就會改叫 alert
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 66.122.205.38
推
02/08 22:35, , 1F
02/08 22:35, 1F
→
02/08 22:35, , 2F
02/08 22:35, 2F
→
02/09 08:22, , 3F
02/09 08:22, 3F
→
02/09 08:22, , 4F
02/09 08:22, 4F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 4 之 4 篇):