我有一段代码来获取Gmail的未读计数。它正在使用jQuery,我想知道如何在没有Javascript库的情况下做到这一点,只需使用Javascript即可。
$.ajax({
type: "GET",
url: "https://mail.google.com/mail/feed/atom",
dataType: "xml",
success: parseXml
});
function parseXml(xml)
{
var result = $(xml).find("fullcount").text();
alert("count:" + result);
}发布于 2012-11-05 04:30:57
好了,解决了
xhrGmail = new XMLHttpRequest();
xhrGmail.open('GET','https://mail.google.com/mail/feed/atom')
xhrGmail.onload = function() { console.log(xhrGmail.responseText.split("<fullcount>") [1].split("</fullcount>")[0]) }
xhrGmail.send(null);发布于 2012-11-04 11:38:34
尝尝这个
var xmlhttp=new XMLHttpRequest();
xmlhttp.setRequestHeader("Access-Control-Allow-Origin","https://mail.google.com");
xmlhttp.open("POST","https://mail.google.com/mail/feed/atom",false,"username","pwd");
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
var mailCount=xmlDoc.getElementsByTagName("entry").length;https://stackoverflow.com/questions/13214801
复制相似问题