title: server side response in twig page for button
body: <p>I want to get a server side response for a button in a twig page.
  As a example - there will be 2 button in the page ----</p>
  
  <p><strong>ON/OFF</strong></p>
  
  <p>When the page load it should check from server (check from elasticsearch database) whether it returns True or false, for both button.</p>
  
  <p>So for instanse we say that for ON button it return "True" it should change it color to green, like ----</p>
  
  <pre><code>$(this).addClass('btn-success');
  $(this).removeClass('btn-primary');
  </code></pre>
  
  <p>The main purpose is to check what's the current status, when the page load.</p>
  
  <p>So this is not a on-click function, because it show show the status when the page is loaded.</p>
  
  <p>I believe there will be some simple solution to solve this problem. </p>
  
  <p>Do anyone knows how to solve this problem.</p>