title: how do i add sweetalert on my ejs file successful output?
body: <p>i have a nodejs file which render one of the ejs file,i need to show up a ssweet alert on my sucessful rendering?Currently l am getting the error which shows "alert is not defined
  THIS IS MY EJS COE</p>
  
  <pre><code>&lt;!DOCTYPE html&gt; 
  &lt;html lang="en"&gt; 
  &lt;head&gt; 
  &lt;meta charset="UTF-8"&gt; 
  &lt;title&gt;&lt;/title&gt; 
  &lt;link rel='stylesheet' href='cdnjs.cloudflare.com/ajax/…'&gt; 
  &lt;link rel="stylesheet" href="/css/style.css" type="text/css"&gt; 
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"&gt;&lt;/script&gt; 
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"&gt;&lt;/script&gt; 
  &lt;/head&gt; 
  &lt;body&gt; 
  &lt;div class="verify"&gt; 
  &lt;form id="checkForm" method="post" action="/verify"&gt; 
  &lt;label for="verify"&gt;&lt;b&gt;Verify&lt;/b&gt;&lt;/label&gt; 
  &lt;input type="text" placeholder="Register no" name="emply_id" required&gt; 
  &lt;button type="submit" class="signupbtn"&gt;Check In&lt;/button&gt; 
  &lt;/form&gt; 
  &lt;/div&gt; 
  &lt;!--&lt;form id="signp" method="get" action="/signup"&gt; 
  &lt;button type="submit" class="signupbtn" &gt;Signup&lt;/button&gt; 
  &lt;/form&gt;--&gt; 
  
  &lt;div class="container" id="container"&gt; 
  &lt;div class="form-container sign-up-container"&gt; 
  &lt;form id="signupForm" method="post" action="/signup"&gt; 
  &lt;h1&gt;Create Account&lt;/h1&gt; 
  &lt;div class="social-container"&gt; 
  &lt;a href="#" class="social"&gt;&lt;i class="fab fa-facebook-f"&gt;&lt;/i&gt;&lt;/a&gt; 
  &lt;a href="#" class="social"&gt;&lt;i class="fab fa-google-plus-g"&gt;&lt;/i&gt;&lt;/a&gt; 
  &lt;a href="#" class="social"&gt;&lt;i class="fab fa-linkedin-in"&gt;&lt;/i&gt;&lt;/a&gt; 
  &lt;/div&gt; 
  &lt;span&gt;or use your email for registration&lt;/span&gt; 
  &lt;input type="text" placeholder="Company Name" name="name"required/&gt; 
  &lt;input type="email" placeholder="Email" name="email" required/&gt; 
  &lt;input type="password" placeholder="Password" name="psw" required/&gt; 
  &lt;input type="password" placeholder="Re-Password" name="pswrepeat" required/&gt; 
  &lt;input type="address" placeholder="Addresss" name="address" required/&gt; 
  
  &lt;button id="myButton"&gt;Sign Up&lt;/button&gt; 
  &lt;/form&gt; 
  &lt;/div&gt; 
  &lt;div class="form-container sign-in-container"&gt; 
  &lt;form id="loginForm" method="post" action="/login"&gt; 
  &lt;h1&gt;Sign in&lt;/h1&gt; 
  &lt;div class="social-container"&gt; 
  &lt;a href="#" class="social"&gt;&lt;i class="fab fa-facebook-f"&gt;&lt;/i&gt;&lt;/a&gt; 
  &lt;a href="#" class="social"&gt;&lt;i class="fab fa-google-plus-g"&gt;&lt;/i&gt;&lt;/a&gt; 
  &lt;a href="#" class="social"&gt;&lt;i class="fab fa-linkedin-in"&gt;&lt;/i&gt;&lt;/a&gt; 
  &lt;/div&gt; 
  &lt;span&gt;or use your account&lt;/span&gt; 
  &lt;h1&gt;Log in &lt;/h1&gt; 
  &lt;hr&gt; 
  &lt;label for="email"&gt;&lt;b&gt;email&lt;/b&gt;&lt;/label&gt; 
  &lt;input type="text" placeholder="Email" name="email" required &gt; 
  &lt;label for="password"&gt;&lt;b&gt;password&lt;/b&gt;&lt;/label&gt; 
  &lt;input type="text" placeholder="Enter Password" name="password" required&gt; 
  &lt;button type="submit" class="signupbtn"&gt;Log in&lt;/button&gt; 
  &lt;/form&gt; 
  &lt;/div&gt; 
  
  &lt;div class="overlay-container"&gt; 
  &lt;div class="overlay"&gt; 
  &lt;div class="overlay-panel overlay-left"&gt; 
  &lt;h1&gt;Welcome Back!&lt;/h1&gt; 
  &lt;p&gt;To keep connected with us please login with your personal info&lt;/p&gt; 
  &lt;button class="ghost" id="signIn"&gt;Sign In&lt;/button&gt; 
  &lt;/div&gt; 
  &lt;div class="overlay-panel overlay-right"&gt; 
  &lt;h1&gt;Hello, Friend!&lt;/h1&gt; 
  &lt;p&gt;Enter your personal details and start journey with us&lt;/p&gt; 
  &lt;button class="ghost" id="signUp"&gt;Sign Up&lt;/button&gt; 
  &lt;/div&gt; 
  &lt;/div&gt; 
  &lt;/div&gt; 
  &lt;/div&gt; 
  
  
  &lt;script src="/js/index.js"&gt;&lt;/script&gt; 
  
  &lt;script&gt; 
  
  $(document).ready(function () { 
  if ("&lt;%= alert %&gt;" === "true") { 
  var alertTitle = "&lt;%= alertTitle %&gt;" 
  var alertMessage = "&lt;%= alertMessage %&gt;" 
  swal(alertTitle, alertMessage, "error"); 
  } 
  }) 
  
  
  
  
  
  &lt;/script&gt; 
  
  
  &lt;/body&gt; 
  &lt;/html&gt;
  </code></pre>
  
  <p>THIS IS MY NODEJS CODE</p>
  
  <pre><code>app.post('/signup',urlencodedParser,async function(req,res){ 
  //console.log(req) 
  var name1 = req.body.name; 
  var email1 = req.body.email; 
  var pass = req.body.psw; 
  var con_pass = req.body.pswrepeat; 
  var address1 = req.body.address; 
  var stat =0; 
  var echeck = await emailcheck(email1) 
  console.log(echeck) 
  var sig ={name:name1,email:email1,password:pass,password1:con_pass,address:address1,status:stat} 
  console.log(name1); 
  if(con_pass == pass){ 
  var cd = sha256(email1) 
  //res.end("sigup submitted"); 
  //res.render('login'); 
  
  var query = db.query('INSERT INTO signup SET ?', sig, async function(err, result) { 
  // Neat! 
  
  console.log(query.sql); 
  var activationinsert = await activation_insert(cd) 
  console.log(activationinsert) 
  var link="http://"+req.get('host')+"/emaillogin?code="+cd; 
  var actmail = await activation_mail(email1,link) 
  console.log(actmail) 
  console.log("get me sweet"); 
  res.render('login', {alert: true, alertTitle: "Oops!", alertMessage: "Something went wrong!"})  
  
  // }); 
  }); 
  
  </code></pre>
  
  <p>I have used this method, this tag method is working fine in html, but when it comes to js, its a complete mess.</p>