Hello, I'm picking up on something very simple. I have a function in jQuery that checks if there is any open modal on the page. For this it checks the class
of <body>
and returns 1 if it has modal open and 0 if it does not.
So far so good. If I give a console.log inside ifs
it works normally. But, now comes the "problem."
I tried several ways to use the return in my script php
but I can not. I just want to get the return, and check if it's equal to 1, if it's got modal open, if it's 0 it does not have it.
Could you help me?
function:
function verifyModals(){
if ($("body").hasClass("modal-open")) {
console.log('modal aberto');
return 1;
}else{
console.log('modal FECHADO');
return 0;
}
}
In my script php
, how do I get the return? a echo "<script>verifyModals();</script>";
would no longer solve?
Thank you in advance