title: ReferenceError: toastr is not defined
body: <p>I´ve been trying to show toast notifications on my page with <a href="https://github.com/CodeSeven/toastr" rel="nofollow noreferrer">toastr.js</a>, but this error keep showing:</p>
  
  <p><a href="https://i.stack.imgur.com/AVL32.png" rel="nofollow noreferrer">The error</a></p>
  
  <p>I already included jquery and both js and css, but didn´t anyway, this is the code:</p>
  
  <blockquote>
    <p>EDIT: when i try to show the toast notifications directly on the html code, it works fine, but when i call them inside of the php function, the error keep appearing</p>
  </blockquote>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  // WHEN I TRY TO SHOW THE ALERT WITH THIS PHP FUNCTION, IT DOESN'T WORKS!
  
  function cms_alert($message, $type) {
   switch ($type) {
    case "info":
     echo "&lt;script&gt;toastr.info('INFO!');&lt;/script&gt;";
     break;
    case "success":
     echo "&lt;script&gt;toastr.success('SUCCESS!');&lt;/script&gt;";
     break;
    case "warning":
     echo "&lt;script&gt;toastr.warning('WARNING!');&lt;/script&gt;";
     break;
    case "error":
     echo "&lt;script&gt;toastr.error('ERROR!');&lt;/script&gt;";
     break;
   }
  }
  ?&gt;
  
      &lt;?php
  
      // THE ERROR IS HAPPENING HERE!
  
  } else {
   // Senão, mostra a página de login
   if (isset($_POST['username'], $_POST['password'])) {
    $username = $_POST['username'];
    $password = ($_POST['password']);
  
    // Caso deixe todos os campos em branco, uma mensagem de erro é mostrada
    if (empty($username) or empty($password)) {
     cms_alert("Preencha todos os campos!", "error");
    } else {
     if ($username == $admin_username and $password == $admin_password) {
      // Usuário digitou login e senha corretos
      $_SESSION['logged_in'] = true;
      
      header('Location: index.php');
      exit();
     } else {
      // Usuário digitou login e senha incorretos
      cms_alert("Nome/senha esta incorreto!", "error");
     }
    }
   }
  
   ?&gt;
  &lt;html&gt;
  &lt;head&gt;
   &lt;meta charset="utf-8"&gt;
   &lt;title&gt;tinyCMS - Login&lt;/title&gt;
   &lt;link rel="stylesheet" href="../assets/style.css"&gt;
   &lt;link rel="stylesheet" href="../assets/w3.css"&gt;
   &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css"&gt;
   &lt;script src="https://code.jquery.com/jquery-3.2.1.min.js"&gt;&lt;/script&gt;
   &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
   &lt;center&gt;
    &lt;h1&gt;&lt;a href="/"&gt;&lt;?php echo $site_name; ?&gt;&lt;/a&gt;&lt;/h1&gt; &lt;!-- Mostra o titulo do site --&gt;
    &lt;h5&gt;&lt;?php echo $site_description; ?&gt;&lt;/h5&gt; &lt;!-- Mostra a descrição do site --&gt;
  
    &lt;hr/&gt;
  
    &lt;h4&gt;Digite seu login e senha para continuar:&lt;/h4&gt;
  
    &lt;!-- LOGIN --&gt;
    &lt;form action="index.php" method="post" autocomplete="off"&gt;
     &lt;input type="text" name="username" placeholder="Usuário" /&gt;
     &lt;input type="password" name="password" placeholder="Senha" /&gt;
     &lt;input type="submit" value="Login" /&gt;
    &lt;/form&gt;
   &lt;/center&gt;
  
   &lt;hr/&gt;
  
   &lt;?php echo $site_footer_admin; ?&gt;
  
  &lt;/body&gt;
  
  &lt;!-- WHEN I USE THE CODE DIRECTLY ON THE HTML FILE, IT WORKS FINE! --&gt;
  
  &lt;script&gt;toastr.error('Hello World!');&lt;/script&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>