check if method in backend is true and client too

Asked

Viewed 47 times

0

I have a code that in my backend it returns true or false, I am working with ruby and Rails 5.

then I have la an if more or less so ja:

<% if @order? %>
    <h2> teste 2 <h2>
<%else>
    <h1>teste 1</h1>
<%end>

however what I want to do is the following if it is true in the backend check if the frontend is also true and add the result true or false inside that if no . erb

something like that:

<% if @order? && var ou algo que retornar true no lado do client  %>
    <h2> teste 2 <h2>
<%else>
    <h1>teste 1</h1>
<%end>

If you have any other idea how to do that, we’d appreciate it.

1 answer

1


This is bad practice. However, here goes:

<script>
if(<%@order> === variavelClient && variavelClient){
console.log('são iguais e verdadeiras')
}
</script>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.