我在google chrome擴展中排除了這個AJAX請求;其中記錄一個錯誤的鉻控制檯:Javascript switch語句undefined error
Uncaught Error: Invalid value for argument 1. Expected 'object' but got 'string'. - extensions/extension_process_bindings.js:66 chromeHidden.validate - extensions/extension_process_bindings.js:66 (anonymous function) - extensions/extension_process_bindings.js:622 xmlhttp.onreadystatechange - popup.html:362
雖然只有那些錯誤之一是在我的代碼,我認爲這是這一部分(即標誌了標記線)
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
if (xmlhttp.responseText != 0)
{
chrome.browserAction.setBadgeText(xmlhttp.responseText); // LINE 362 - FINAL ERROR
chrome.browserAction.setBadgeBackgroundColor(255,0,0,255);
document.getElementById("alerts").innerHTML = xmlhttp.responseText;
}
}
}
xmlhttp.open("GET","http://adams-site.x10.mx/checkalerts.php?
day="+dayname,true);
xmlhttp.send();
}
謝謝。工作過一種享受! – ACarter 2011-12-21 11:53:24