lundi 5 août 2019

How to show Messages on a toast in Materializecss

I am doing this Toast stuff from materialize together with Laravel 5.8. My problem now is the toast messages is returning an empty message whenever i call it. This is what i have so far:

<button type="submit" name="submit" form="lt-add-form" class="btn btn-small" id="lt-btn-save" style="border-radius: 0;" onclick="showToast(, 3000)"><i class="fas fa-save"></i>Save</button>

and i have this javascript method:

function showToast(message, duration) {
    console.log(message['name']+" "+message['code']);
    //for (var i=0; i<message.length; i++) {
        M.toast(message, duration);
    //}
}

and also, on my first click on my save button. It gives me an undefined value just like the image below:

enter image description here

Any help is much appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire