title: How to execute JavaScript function in an Ajax() Response
body: <p>I have a home page that load the ajax() response and post it to UL as LI content, with the same page I have script function that can select the LI content with trigger for another function, but isn’t working. </p>
  
  <p><em>PAGE 1</em></p>
  
  <p>HTML</p>
  
  <pre><code>&lt;ul id="feature-deals" class="list-products allShopping-deals"&gt;         
  &lt;/ul&gt;
  </code></pre>
  
  <p>SCRIPT</p>
  
  <pre><code>$(document).ready(function(){
      $.ajax({
          url: "Product/Shopping-Trending-Items.php", 
          success: function(result){
              $(".allShopping-deals").html(result);
          }
      });
  
  $(".products").click(function (){   
          alert ($('.pid', this).text());
  </code></pre>
  
  <p><em>PAGE 2</em></p>
  
  <p>HTML</p>
  
  <pre><code>  &lt;li class="products"&gt;
  &lt;span class="pid"&gt;1234&lt;/span&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>page 1 == home page w/(ajax() load function + click function) ----> page 2 == Li content holding pid and waiting to load by ajax() ----> target output is to alert the pid value but the script is in page 1</p>