jquery updation after ajax search updation
<p>i have a script which works for deletion confirmation...</p>

<pre><code>$('document').ready(function(){
     $('.ask').jConfirmAction();
});
</code></pre>

<p>and the table of products listing is under below</p>

<pre><code>&lt;?php if(isset($query)){ ?&gt;        
&lt;input disabled type="hidden" id="recNum" value="&lt;?php echo $rec ?&gt;"/&gt;
&lt;table id="rounded-corner" summary="2007 Major IT Companies' Profit" width="100%"&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th scope="col" class="rounded-company"&gt;&lt;/th&gt;
            &lt;th scope="col" class="rounded"&gt;Product ID&lt;/th&gt;
            &lt;th scope="col" class="rounded"&gt;Product Name&lt;/th&gt;
            &lt;th scope="col" class="rounded"&gt;Product slug&lt;/th&gt;
            &lt;th scope="col" class="rounded"&gt;Type&lt;/th&gt;
            &lt;th scope="col" class="rounded"&gt;Product Category&lt;/th&gt;
            &lt;th scope="col" class="rounded"&gt;Edit&lt;/th&gt;
            &lt;th scope="col" class="rounded-q4"&gt;Delete&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
        &lt;tfoot&gt;
        &lt;tr&gt;
            &lt;td colspan="7" class="rounded-foot-left"&gt;&lt;em&gt;All The Pages That Being Included&lt;/em&gt;&lt;/td&gt;
            &lt;td class="rounded-foot-right"&gt;&amp;nbsp;&lt;/td&gt;

        &lt;/tr&gt;
    &lt;/tfoot&gt;
    &lt;tbody&gt;
         &lt;?php
     foreach($query as $key =&gt; $row) {
    ?&gt; 
        &lt;tr&gt;
            &lt;td&gt;&lt;input type="checkbox" name="" /&gt;&lt;/td&gt;
            &lt;td&gt;&lt;?php echo $row['product_id'];?&gt;&lt;/td&gt;
            &lt;td&gt;&lt;?php echo $row['product_name'];?&gt;&lt;/td&gt;
            &lt;td&gt;&lt;?php echo $row['product_slug'];?&gt;&lt;/td&gt;
            &lt;td&gt;&lt;?php echo $row['type'];?&gt;&lt;/td&gt;
            &lt;td&gt;&lt;img src="&lt;?php echo base_url().$row['product_image'];?&gt;" width="80px" height="80px"/&gt;&lt;/td&gt;
            &lt;td&gt;&lt;a href="&lt;?php echo base_url();?&gt;admin.php/products/edit_product/&lt;?php echo $row['product_id'];?&gt;"&gt;&lt;img src="&lt;?php echo base_url();?&gt;assets/admin_assets/images/user_edit.png" alt="" title="" border="0" /&gt;&lt;/a&gt;&lt;/td&gt;
            &lt;td&gt;&lt;a href="&lt;?php echo base_url();?&gt;admin.php/products/delete_product/&lt;?php echo $row['product_id'];?&gt;" class="ask"&gt;&lt;img src="&lt;?php echo base_url();?&gt;assets/admin_assets/images/trash.png" alt="" title="" border="0" /&gt;&lt;/a&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;?php
        }?&gt;


    &lt;/tbody&gt;
&lt;/table&gt;

     &lt;a href="&lt;?php echo base_url();?&gt;admin.php/products/add_product" class="bt_green"&gt;&lt;span class="bt_green_lft"&gt;&lt;/span&gt;&lt;strong&gt;Add new item&lt;/strong&gt;&lt;span class="bt_green_r"&gt;&lt;/span&gt;&lt;/a&gt;
     &lt;a href="&lt;?php echo base_url();?&gt;admin.php/products/view_product" class="bt_blue"&gt;&lt;span class="bt_blue_lft"&gt;&lt;/span&gt;&lt;strong&gt;View all items from category&lt;/strong&gt;&lt;span class="bt_blue_r"&gt;&lt;/span&gt;&lt;/a&gt;
     &lt;a href="#" class="bt_red"&gt;&lt;span class="bt_red_lft"&gt;&lt;/span&gt;&lt;strong&gt;Delete items&lt;/strong&gt;&lt;span class="bt_red_r"&gt;&lt;/span&gt;&lt;/a&gt; 
</code></pre>

<p>heres the jquery for the jQuery confirmation:</p>

<pre><code>/*
 * jQuery Plugin : jConfirmAction
 * 
 * by Hidayat Sagita
 * http://www.webstuffshare.com
 * Licensed Under GPL version 2 license.
 *
 */
(function($){

    jQuery.fn.jConfirmAction = function (options) {
        // Some jConfirmAction options (limited to customize language) :
        // question : a text for your question.
        // yesAnswer : a text for Yes answer.
        // cancelAnswer : a text for Cancel/No answer.
        var theOptions = jQuery.extend ({
            question: "Are You Sure ?",
            yesAnswer: "Yes",
            cancelAnswer: "Cancel"
        }, options);

        return this.each (function () {

            $(this).bind('click', function(e) {

                e.preventDefault();
                thisHref    = $(this).attr('href');

                if($(this).next('.question').length &lt;= 0)
                    $(this).after('&lt;div class="question"&gt;'+theOptions.question+'&lt;br/&gt; &lt;span class="yes"&gt;'+theOptions.yesAnswer+'&lt;/span&gt;&lt;span class="cancel"&gt;'+theOptions.cancelAnswer+'&lt;/span&gt;&lt;/div&gt;');

                $(this).next('.question').animate({opacity: 1}, 300);

                $('.yes').bind('click', function(){
                    window.location = thisHref;
                });

                $('.cancel').bind('click', function(){
                    $(this).parents('.question').fadeOut(300, function() {
                        $(this).remove();
                    });
                });

            });

        });
    }

})(jQuery);
</code></pre>

<p>all the thing was working well,</p>

<p>then i made ana jax pagination for the lists;</p>

<p>now the problem is that after this task, the jquery confirmation isnt working, i want the jquery script to be converted into simple jquery function like this</p>

<pre><code>function ask()
{

}
</code></pre>

<p>EDIT:</p>

<p>i have written the function</p>

<pre><code>function ask(obj)
{
alert('hii');
                    //var theOptions = jQuery.extend ({
            var question= "Are You Sure ?";
            var yesAnswer= "Yes";
            var cancelAnswer= "Cancel";
            //e.preventDefault();

                    var thisHref = $(obj).attr('href');
            alert(thisHref) ;
                if($(obj).next('.question').length &lt;= 0)
                    $(obj).after('&lt;div class="question"&gt;'+question+'&lt;br/&gt; &lt;span class="yes"&gt;'+yesAnswer+'&lt;/span&gt;&lt;span class="cancel"&gt;'+cancelAnswer+'&lt;/span&gt;&lt;/div&gt;');

                $(obj).next('.question').animate({opacity: 1}, 300);

                $('.yes').bind('click', function(){
                    window.location = thisHref;
                });

                $('.cancel').bind('click', function(){
                    $(obj).parents('.question').fadeOut(300, function() {
                        $(obj).remove();
                    });
                });

}
</code></pre>

<p>and i am calling this from</p>

<pre><code>&lt;a href="&lt;?php echo base_url();?&gt;admin.php/products/delete_product/&lt;?php echo $row['product_id'];?&gt;" class="ask" onclick="ask(this);"&gt;&lt;img src="&lt;?php echo base_url();?&gt;assets/admin_assets/images/trash.png" alt="" title="" border="0" /&gt;&lt;/a&gt;
</code></pre>

<p>its taking the effect also;
but just after the animating effect, its getting redirected to the link, i need to make it stay, so that user can choose the option. but i cant...</p>

<pre><code>MORE EDIT:
</code></pre>

<p>Ok i got the answer; i used the small code return false and it solved my problem</p>

<p>but then there's another problem</p>

<p>this line of code isnt working</p>

<pre><code>$('.cancel').bind('click', function(){
                        $(obj).parents('.question').fadeOut(300, function() {
                            $(obj).remove();
                        });
                    });
</code></pre>
