How to make an API connection to my Javascript project?

Hi guys,

I have a Javascript news feed that automatically scrolls. I want to know if this is possible to connect this with Google Calendar via its API key so that the Google events can show up on the Javascript news feed?

Here’s the code for your reference, and you can test-run it.

Thanks for your help.

<!DOCTYPE html>

<script src=""></script>
<link href="/resources/msite/css/style.css" rel="stylesheet">
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>


    <h3>Demo 1 - Direction: Up</h3>
    <!------------------------------- DEMO 1 --------------------------->
    <div class="demo4 demof">
            <li><img src="images/img1.jpg" alt="Sample image" /><a href="#">The world of Gilbert and George</a><p>The art duo of Gilbert and George on how their work can ruffle feathers and the benefits of routine.</p></li>
            <li class="odd"><img src="images/img2.jpg" alt="Sample image" /><a href="#">From propaganda to pop artist</a><p>Song Byeok had every reason to be pleased with his success. A gift for drawing led to a prestigious career as a propaganda artist and full membership in North Korea's communist party.</p></li>
            <li><img src="images/img3.jpg" alt="Sample image" /><a href="#">Japan's inspirational footballer</a><p>CNN's Kyung Lah sits down with Japan's World Cup-winning captain to reflect on their win amid tragedy.</p></li>

    border: 1px solid #ccc;
    margin: 25px 0;
.demof ul{
    padding: 0;
    list-style: none;
.demof li{
    padding: 20px;
    border-bottom: 1px dashed #ccc;
.demof li.odd{
    background: #fafafa;
.demof li:after {
    content: '';
    display: block;
    clear: both;
.demof img{
    float: left;
    width: 100px;
    margin: 5px 15px 0 0;
.demof a{
    font-family: Arial, sans-serif;
    font-size: 20px;
    font-weight: bold;
    color: #06f;
.demof p {
    margin: 15px 0 0;
    font-size: 14px;

.demo3 {
    font-family: Arial, sans-serif;
    border: 1px solid #C20;
    margin: 50px 0;
    font-style: italic;
    position: relative;
    padding: 0 0 0 80px;
    box-shadow: 0 2px 5px -3px #000;
    border-radius: 3px;
.demo3:before {
    content: "Latest News";
    display: inline-block;
    font-style: normal;
    background: #C20;
    padding: 10px;
    color: #FFF;
    font-weight: bold;
    position: absolute;
    top: 0;
    left: 0;
.demo3:after {
    content: '';
    display: block;
    top: 0;
    left: 80px;
    background: linear-gradient(#FFF, rgba(255, 255, 255, 0));
    height: 20px;
.demo3 ul li {
    list-style: none;
    padding: 10px 0;

    border: 2px solid #cecece;
    margin-top: 10px;
    border-radius: 6px;

    border: 2px solid #FF3333;
    margin-top: 10px;
    border-radius: 10px;
    width: 500px;
    -webkit-box-shadow: inset 0px 0px 10px 1px rgba(0, 0, 0, 0.3);
    -moz-box-shadow: inset 0px 0px 10px 1px rgba(0, 0, 0, 0.3);
    box-shadow: inset 0px 0px 10px 1px rgba(0, 0, 0, 0.3);
.demo5 ul{
    padding: 0;
.demo5 ul li{
    padding: 10px 10px 10px 10px;
    border-bottom: 1px solid #FF3333;
    border-radius: 10px;
    list-type: none;
    margin: 0;
    background-color: #0cf;
    color: white;
    border: 1px solid black;

        direction: 'up'
        direction: 'down',
        visible: 1,
        interval: 4000
        direction: 'up',
        interval: 2500
        direction: 'up',
        visible: 3,
        easing: 'easeInBack',
        controls: {
            up: '.btnUp',
            down: '.btnDown',
            toggle: '.btnToggle'


Have you looked into using Promises?

      .then(response => response.json())
      .then(json => {
        // whatever you want to do with the returned data here