I am creating form using html and php,after submission of form i want to display success message with sweetalert and want to locate window to another page.I tried following code but but it is not working.Please tell me where i am going wrong
echo '<script type="text/javascript">';
echo 'setTimeout(function () {';
echo 'swal("Success!","Your complaint has been successfully registered.\n Your Customer Complaint No. is\n "+"'.$complainno.'","success")
.then( function(val) { if (result.value) {
window.location = "/cashier.php";
}';
echo '});';
echo '}, 200); </script>';