Re: [問題] alert( $.ajax )

看板Ajax作者 (鞭策自己社清流夜靈)時間12年前 (2012/02/08 05:56), 編輯推噓1(103)
留言4則, 2人參與, 最新討論串4/4 (看更多)
※ 引述《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
不建議使用 alert 會使所有 thread 停住... 請用 <div>
02/08 22:35, 1F

02/08 22:35, , 2F
append content
02/08 22:35, 2F

02/09 08:22, , 3F
反正自定義的log dir就可以自己去改寫了~ 看需求
02/09 08:22, 3F

02/09 08:22, , 4F
通常我是直接關掉~ 反正我debug都用chrome
02/09 08:22, 4F
文章代碼(AID): #1FCPtvSJ (Ajax)
討論串 (同標題文章)
文章代碼(AID): #1FCPtvSJ (Ajax)