Answers for "how to write random quote machien"

0

how to write random quote machien

const getQuote = data => {
  // 1) here we are creating the callback function that we will pass to the JSONP request
  const callbackName = 'displayQuote'
  window[callbackName] = function(data) {
    delete window[callbackName]
    document.body.removeChild(script)
    callback(data)
  }

  // 2) we are injecting the script tag into our HTML
  const script = document.createElement('script')
  script.src =
    url + (url.indexOf('?') >= 0 ? '&' : '?') + 'callback=' + callbackName
  document.body.appendChild(script)
}
Posted by: Guest on February-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language