Calling a swal function in php

#calling the swal function::

<script>
function notify() {
   swal({
  title: "Are you sure?",
  text: "Login Required.You will redirect for login.",
type: "warning",
showCancelButton: true,      confirmButtonColor: "#DD6B55",
confirmButtonText: "Go to Login",

closeOnConfirm: false

 },
function(){
 swal("Redirect!", "You will redirect for login", "success");

window.location.replace('login.php');

  });
 }
</Script>