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>';
Here is the solution :
echo '<script>
setTimeout(function() {
swal({
title: "Success!",
text: "Your complaint has been successfully registered.Your Customer Complaint No. is"+$complainno,
type: "success"
}, function() {
window.location.href = "cashier.php"; // window.location also can be used
});
}, 1000);
</script>';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.