jeudi 25 juillet 2019

How to call a javascript function from if statement of Laravel?

I want to call a javascript function from if statement of Laravel Blade. Is it possible?

@if(compareParent())
   Print Something
@endif

Javascript:

function compareParent() {
    $(".CategoryIDForModal").click(function () {
    var id = $(this).data(id);
    var parent_id = $('.subcategoryPID').text();

     console.log(id.id + " Parent: " + parent_id);
     if(id==parent_id)
    return true;
     else
    return false;
     })
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire