I am exceuting this AJAX request in a google chrome extension; which logs an error in the chrome console:
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
Although only one of those errors is in my code, I think it’s this section (The line that flags up is marked)
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();
}
According to a sample from the Chrome extension site (and the API) you need to pass an object (which the error suggests) instead of just passing the text.
From the sample:
So likely you just need: