Last active
June 20, 2020 11:47
-
-
Save Jonoans/8fe4dc404b08a768174ed62c03b14720 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
var udata = Cookies.get("userdata"); | |
if (typeof udata !== 'undefined') { | |
var lambda_endpoint = "https://lambda-" | |
var domain = window.location.hostname | |
var apigw = lambda_endpoint.concat(domain) | |
$.ajax({ | |
type: "POST", | |
url: "https://oo5apsmnc8.execute-api.eu-west-1.amazonaws.com/stag/wx01", | |
contentType: 'application/json', | |
data: JSON.stringify({ | |
'userdata': udata | |
}), | |
success: function(res) { | |
$("#output").append(res.body); | |
}, | |
error: function(err) { | |
console.log(err); | |
} | |
}); | |
} | |
$("#submit").click(function(e) { | |
e.preventDefault(); | |
var name = $("#name").val() | |
var lambda_endpoint = "https://lambda-" | |
var domain = window.location.hostname | |
var apigw = lambda_endpoint.concat(domain) | |
$.ajax({ | |
type: "POST", | |
url: "https://oo5apsmnc8.execute-api.eu-west-1.amazonaws.com/stag/wx01", | |
contentType: 'application/json', | |
data: JSON.stringify({ | |
'name': name | |
}), | |
success: function(res) { | |
var userdata = Cookies.set("userdata", res.body) | |
$("#output").append("Reload for your greeting...") | |
}, | |
error: function(err) { | |
console.log(err); | |
} | |
}); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment