title: Pass php variable using jquery ajax to a modal
body: <p>I am having a problem with my jquery ajax script. I can not get it to pass the variable to the modal. I have been messing with this all weekend and can not figure out way it does not pass the variable.</p>
  
  <p>This is the link to call the modal and the id I am trying to pass</p>
  
  <pre><code>echo '&lt;img src="./images/see.png" class="open-editexpenses" data-target="#editexpenses" data-id="' . $value['expid'] . '" &gt;';
  </code></pre>
  
  <p>This is the jquery ajax script</p>
  
  <pre><code>$(document).on('click', '.open-editexpenses', function() {
                  var id = $(this).data('id');
                  $.ajax({
                      type: "POST",
                      url: "expenses.php",
                      data: {id: id},
                      success: function() {
                          $('#editexpenses').modal('show');
                      }
                  });
              });
  </code></pre>
  
  <p>This is the modal I am opening</p>
  
  <pre><code>&lt;div class="modal fade" id="editexpenses" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
    &lt;div class="modal-dialog"&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
          &lt;h4 class="modal-title" id="myModalLabel"&gt;Modal title&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
  
        &lt;?php
  
          echo $id;
           var_dump($_POST);
           //var_dump($_GET); 
                   ?&gt;  
  
  
  
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
          &lt;button type="button" class="btn btn-primary"&gt;Save changes&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;&lt;!-- /.modal-content --&gt;
    &lt;/div&gt;&lt;!-- /.modal-dialog --&gt;
  &lt;/div&gt;&lt;!-- /.modal --&gt;
  </code></pre>