I'm using this toast message plugin in a PHP project. http://akquinet.github.io/jquery-toastmessage-plugin/
What I need is trigger the message from the PHP validation / query result. Like:
if ($data === FALSE) { // No product found with the called id. Return to the catalog page throwing error message
// Trigger Message from here ...
header('location: products.php');
}
If I simply echo the script call code or include in template like this:
$message = "
<script>
$().toastmessage('showToast', {
text : 'No product found with the specified criteria',
sticky : 1,
position : 'top-right',
type : 'Error',
closeText: '',
close : function () {
}
});
</script>";
echo $message;
it works, but the problem arises when the page gets refreshed (as stated in the example) to ensure no resubmission of the form then the echo gets lost as on refresh it runs out of the validation process and the message doesn't appear.
Any way to handle this?
products.php?showMessage=1or something like that.