Datatable Jquery second page record delete event does not work
<p>I am using datatable jquery for my records fetched from database and i wanted to perform edit and delete event for each records.</p>
<p>The datatable is paginated and I am facing problem with delete function.</p>
<p>For the delete function on first page It gets sucesfully executed as shown in the image below</p>
<p><a href="https://i.stack.imgur.com/fDplm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fDplm.png" alt="calling delete function from first pagination" /></a></p>
<p>This is my second pagination page and it does not even call the function</p>
<p><a href="https://i.stack.imgur.com/RRP2u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RRP2u.png" alt="The second pagination" /></a></p>
<p>This is my html code</p>
<pre><code>&lt;a class=&quot;supp_delete_link&quot; id=&quot;&lt;?php echo $user-&gt;ID; ?&gt;&quot;&gt;
              &lt;i class=&quot;link black remove icon&quot;&gt;&lt;/i&gt;
            &lt;/a&gt;&lt;/td&gt;
</code></pre>
<p>This is my javascript code</p>
<pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
         $(function(){
           $(&quot;.supp_delete_link&quot;).click(function(){
             debugger;
             var element = $(this);
             var del_id = element.attr(&quot;id&quot;);
             console.log(del_id);
             var info = del_id;
         if(confirm(&quot;Are you sure you want to delete this?&quot;))
         {
          $.ajax({
            type: &quot;GET&quot;,
            url: &quot;supplierdelete&quot;+'/'+info,
            data: info,
            success: function(){
          }
         });
           $(this).parents(&quot;.show&quot;).animate({ backgroundColor: &quot;#003&quot; }, &quot;slow&quot;)
           .animate({ opacity: &quot;hide&quot; }, &quot;slow&quot;);
          }
         return false;
         });
         });
&lt;/script&gt;
</code></pre>
<p>The above code works perfectly when I am on the first pagination but does not at all called when on the second page.</p>
<p>More creepy is, it does not even show any error in console.
I am stuck.</p>