Skip to content

Instantly share code, notes, and snippets.

@jb41
Created July 14, 2017 13:38
Show Gist options
  • Save jb41/35c3e01e188685b056e0310a83e3ef5b to your computer and use it in GitHub Desktop.
Save jb41/35c3e01e188685b056e0310a83e3ef5b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="//script.sheetsu.com/"></script>
</head>
<body>
<script>
function getParamsFromUrl(url) {
var search_string;
if (typeof url == "undefined") {
search_string = window.location.href;
} else {
search_string = url;
}
if (search_string.indexOf('?') <= -1) {
return {};
} else {
search_string = search_string.substring(search_string.indexOf("?") + 1);
return parse({}, search_string.split('&'));
}
}
function parse(params, pairs) {
var pair = pairs[0];
var parts = pair.split("=");
var key = decodeURIComponent(parts[0]);
var value = decodeURIComponent(parts.slice(1).join('='));
if (typeof params[key] === "undefined") {
params[key] = value;
} else {
params[key] = [].concat(params[key], value);
}
return pairs.length == 1 ? params : parse(params, pairs.slice(1));
}
var user = {};
function successFunc(data) {
user = data[0];
}
params = getParamsFromUrl(window.location.href);
Sheetsu.read("https://sheetsu.com/apis/v1.0/020b2c0f/", {search: params}, successFunc);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment