title: jQuery closure: How to get a value from a function click
body: <p>I don't quite understand JS closures and I think it can solve my problem. here it is: </p>
  
  <p>I have something like that : </p>
  
  <pre><code>$(document).ready(function () {
      $("#buttonConfirm").click(function () {
          popup_confirme();
      });
  });
  function popup_confirme() {
      var r = popup_modal();
  }
  function popup_modal() {
      var int_val = 0;
      $(".button").click(function () {
          int_val = ($(this).val() == 'yes' ? '1' : '0');
      });
      return int_val;
  }
  </code></pre>
  
  <p>I would like to get my int_val returned by the button click event. I need to get the 'r' value as 0 or 1. I know I should use closures, but I dont know how to do it. Thank you for your expertise ! </p>