So I'm not that great with javascript, but I'm trying to make a mail notification or this sort of things.
So far I'm using gmails xml file that will display the number of unread emails under a fullcount tag. I want to fetch this with javascript and display it on a html page. Is there a better way to do this?
So far I've come up with this:
HTML:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<link rel="stylesheet" href="style.css">
<script src="gmail.js"></script>
</head>
<body onload=getgmail();>
<div id="container">
<div id="gmail">
<p id="mail">0</p>
</div>
</div>
</body>
</html>
Javascript:
function getgmail() {
//loadpage
$.get("https://USERNAME:[email protected]/mail/feed/atom", function(data));
//get variable inside fullcount tags
var mailcount= document.getElementsByTagName('fullcount');
//output variable to html
document.getElementById('mail').innerHTML = fullcount;
}
I'm probably doing it completely wrong and I would appreciate your help! thanks