Skip to content

Instantly share code, notes, and snippets.

@bDrwx
Created January 6, 2019 13:57
Show Gist options
  • Save bDrwx/434e90c813fab16995588bbd07eb13b7 to your computer and use it in GitHub Desktop.
Save bDrwx/434e90c813fab16995588bbd07eb13b7 to your computer and use it in GitHub Desktop.
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
$(document).ready(function() {
$.ajax({
type: "GET",
url: 'https://p8dmwkfw4d.execute-api.ap-southeast-1.amazonaws.com/default/ruby-function',
data: 'username='.getUrlVars().username,
contentType: 'application/json',
success: function(res){
console.log(res);},
error: function(){
console.log('Something get wrong!');}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment