Why this code doesnot work, need debug


#1

See the Pen Random Quote by Eldar (@eldarm) on CodePen.


#2

When you submit a form, the default action is to reload the page. To prevent it you should use preventDefault():

function loadData(e) {  // <-- e is event (in this case submit)
  e.preventDefault()  // <-- prevent default event action (don't reload)
  ...