Skip to content

Instantly share code, notes, and snippets.

@jonathands
Last active February 26, 2019 20:55
Show Gist options
  • Select an option

  • Save jonathands/4490ef6657701a2dba88a1bebf2556d8 to your computer and use it in GitHub Desktop.

Select an option

Save jonathands/4490ef6657701a2dba88a1bebf2556d8 to your computer and use it in GitHub Desktop.
<iframe id="estanteiframe" height="850" style="width: 100%; margin: 0; padding: 0" frameborder="0" src=""> </iframe>
<script type="text/javascript">
let req = new XMLHttpRequest();
let publicServiceKey = 'CODIGODESUAESTANTE';
req.open('GET', 'https://www.businessinformativos.com.br/Services/Informativos/json?auth=' + publicServiceKey, true);
req.onload = function () {
if (req.status >= 200 && req.status < 400) {
let jsonRev = JSON.parse(req.responseText);
document.querySelector('#estanteiframe').setAttribute("src",jsonRev.infos[0].hlink)
console.log(jsonRev.infos[0].hlink);
} else {
alert('Erro ao carregar os informativos');
}
}
req.send();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment