Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Calendar API Javascript Quickadd
    primarykey
    data
    text
    <p>Trying to allow a user to authenticate and quickadd an event using the Google calendar API v3 with javascript. I dont see the authenticate button. I am very inexperienced with coding.</p> <p>Console:</p> <pre><code>Uncaught SyntaxError: Unexpected token } test.html:47 Uncaught TypeError: Cannot read property 'qainput' of undefined test.html:62 onload test.html:62 </code></pre> <p>html file:</p> <p></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta charset='utf-8' /&gt; &lt;style&gt; #info { border: 0px solid black; padding: 0.25em; margin: 0.5em 0; } &lt;/style&gt; &lt;script type="text/javascript"&gt; var apiKey = 'AIzaSyDcbjOvAT85hCdVrjgUAqylf_QtxE2Gx60'; var clientId = '202852486259.apps.googleusercontent.com'; var scopes = 'https://www.googleapis.com/auth/calendar'; function handleClientLoad() { gapi.client.setApiKey(apiKey); window.setTimeout(checkAuth,1); } function checkAuth() { gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, handleAuthResult); } function handleAuthResult(authResult) { var authorizeButton = document.getElementById('authorize-button'); if (authResult) { authorizeButton.style.visibility = 'hidden'; makeApiCall(); } else { authorizeButton.style.visibility = ''; authorizeButton.onclick = handleAuthClick; } } function handleAuthClick(event) { gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult); return false; } function makeRpcRequest() { var qatext = document.qaform.qainput.value; var request = gapi.client.calendar.events.quick_add({ 'calendarId': 'primary', 'text': +qatext+ }); request.execute(writeResponse); } function writeResponse(response) { console.log(response); var name = response.summary; var infoDiv = document.getElementById('info'); var infoMsg = document.createElement('P'); infoMsg.appendChild(document.createTextNode(+ name' sucessfully created!')); infoDiv.appendChild(infoMsg); } &lt;/script&gt; &lt;script src="https://apis.google.com/js/client.js?onload=handleClientLoad"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body onload="document.qaform.qainput.focus();"&gt; &lt;button id="authorize-button" style="visibility: hidden"&gt;Authorize to Use QuickAdd&lt;/button&gt; &lt;form id="qaform"&gt; &lt;input placeholder='QuickAdd' name='qainput' /&gt; &lt;button id="rpc" onclick="makeRpcRequest();"&gt;Add&lt;/button&gt; &lt;/form&gt; &lt;div id="info"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload