title: ajax query onclick Uncaught SyntaxError
body: <p>I have a working code using javascript event "onchange" :</p>
  
  <pre><code>&lt;select id="mySelect" onchange="change_table(this)"&gt;
  </code></pre>
  
  <p>the jquery :</p>
  
  <pre><code>unction change_table(elem) {
  
  var adressesInfo;
  
  $.ajax({
      type: "POST",
      url: "test.php",        
      data: {id: elem.value},
  
      success: function(data){
          adressesInfo = jQuery.parseJSON(data);
      },
  
      async: false
  });
  </code></pre>
  
  <p>and the php :</p>
  
  <pre><code>$data = array();
  [...]
  print json_encode($data);
  </code></pre>
  
  <p>This is working fine.</p>
  
  <p>Now I want to do exactly the same, but using an onclick event on the th elements:</p>
  
  <pre><code>$(function(){
      $("th").on('click', function(e){
          change_table($('#mySelect')[0].value);
      });
  })
  </code></pre>
  
  <p>(This might not make much sense to do, but this is just for the sake of the example)</p>
  
  <p>When I do this, i get the error <code>Uncaught SyntaxError: Unexpected token &lt;</code></p>
  
  <p>I'm a bit confused on why it would work with onchange event and no onclick event, what is the difference ? i'm kinda new to jquery/ajax.</p>
  
  <p>Thanks for your help.</p>