Skip to content

Instantly share code, notes, and snippets.

@Shuumatsu
Created March 20, 2017 16:44
Show Gist options
  • Save Shuumatsu/8ad22262a4d0e2e604298097d882b53b to your computer and use it in GitHub Desktop.
Save Shuumatsu/8ad22262a4d0e2e604298097d882b53b to your computer and use it in GitHub Desktop.
JSONP
<div id="data"></div>
<body>
<script>
const div = document.querySelector('div')
const print = arg => div.insertAdjacentText('beforeend', arg)
</script>
<script src="https://en.wikipedia.org/w/api.php?action=opensearch&format=json&callback=print&search=google"></script>
* {
box-sizing: border-box;
}
#data {
padding: 16px;
position: absolute;
left: 50%;
top: 50%;
transform: translate3d(-50%, -50%, 0);
width: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment