Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions google_sign-in.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<html lang="en">
<head>
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="550144110348-puc1jhgg5v7d3p8l8ar4940ab0nsjb50.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>
<style>
.g-signin2{
margin-left: 50%;
margin-top: 50%;
}
</style>
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark">
<div></div>
</div>
<script>
function onSignIn(googleUser) {
// Useful data for your client-side scripts:
var profile = googleUser.getBasicProfile();
console.log("ID: " + profile.getId()); // Don't send this directly to your server!
console.log('Full Name: ' + profile.getName());
console.log('Given Name: ' + profile.getGivenName());
console.log('Family Name: ' + profile.getFamilyName());
console.log("Image URL: " + profile.getImageUrl());
console.log("Email: " + profile.getEmail());

// The ID token you need to pass to your backend:
var id_token = googleUser.getAuthResponse().id_token;
console.log("ID Token: " + id_token);
}
</script>
</body>
</html>
30 changes: 30 additions & 0 deletions js/ajax-questions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

var xhttp = new XMLHttpRequest();
var question;
var team_name;
xhttp.open("GET", "url", true);
xhttp.setRequestHeader("Content-Type", "application/json");
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

var json = JSON.parse(this.responseText);
console.log(json);
question = json.question;
team_name = json.team_name;
console.log(question,team_name);
}
};

xhttp.send();

function sendres() {
var ans = JSON.stringify(document.getElementById("").innerHTML);
var res = new XMLHttpRequest();
res.open("POST","url",true);
res.setRequestHeader("Content-Type", "application/json");
res.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
}
};
res.send(ans);
}