Preview:
/* create a function to search pubmed and display it in an html div */
function searchPubmed(query) {
  var url = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=' + query + '&retmax=10&retmode=json';
  var xhr = new XMLHttpRequest();
  xhr.open('GET', url, true);
  xhr.onreadystatechange = function() {
    if (xhr.readyState == 4) {
      var response = JSON.parse(xhr.responseText);
      var ids = response.esearchresult.idlist;
      var div = document.createElement('div');
      div.innerHTML = '<h2>Pubmed search results for "' + query + '"</h2>';
      for (var i = 0; i < ids.length; i++) {
        div.innerHTML += '<a href="https://www.ncbi.nlm.nih.gov/pubmed/' + ids[i] + '">' + ids[i] + '</a><br>';
      }
      document.body.appendChild(div);
    }
  };
  xhr.send();
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter