javascriptphpmaterial-design-lite

Activating TOAST messages via _POST / _GET (mdl)


After successful or unsuccessful execution of a PHP script, i want to display the execution result on the site in the form of a pop-up notification. How can I do this better? Let's say I pass the result via _GET or _POST Is it possible to use a toast for this, something like:

if (isset $_POST['message']) {
$message = $_POST['message'];
showmessage("$message");
}

I know that in PHP there is no such thing as ShowMessage, but I’m not very strong in JS.


Solution

  • Use php to echo out a script block:

    if (isset($_POST['message'])) {
        echo "<script type=\"text/javascript\">alert('SUCCES!');</script>"; 
       exit;
    }