title: How to make javascript in innerHTML work after an AJAX
body: <p>I'm  making a voting system. After user click those button(div),an ajax will be called to pass data to another page doing SQL to insert session id, vote value, vote id and showing the new total<br>
   <strong>here is my ajax</strong> </p>
  
  <pre><code>$('.like').on('click', function(){
      var voteclass=2;
      var vote_id=$(this).parent().attr("id");
      var poststr="voteclass="+voteclass+"&amp;voteteacher="+vote_teacher;
      $.ajax({
      url:"insert.php",
      cache:0,
      data:poststr,
      success:function(result){
      $('#'vote_id).html(result);}  });   });
  </code></pre>
  
  <p>After ajax, <strong>insert.php</strong> do the SQL and show the result which is the same voting div content as fontpage but with new total value.<br> My question is that I cannot vote again without refresh the whole page. Is it means that innerHTML cannot load the script within the head element of outer ( I don't know what term is ) page? and how can I solve it?</p>