0

I have made a jquery function which will change status to complete if pending .

The function is executing properly on first button click and it is loading my table changing my status to complete.

enter image description here

But on second time on button click it is not reading the function.

Here is my jquery code:

 $('a.success_btn').click(function(e){
          e.preventDefault();
        var id = $(this).attr('id');
        var status = "completed";
        $.ajax({
            type: "POST",
            url: "includes/vorder.php",
            data:{ o_id: id, o_status: status }, 
            success: function(data){
                alert(data);
                $('#all_order').load('orders.php #all_order');
            }
        })  
      });

Here:

a.success_btn = button class name

'#all_order'= my order table div id

The table is on another php page means '#all_order' and it has been included to this page.

1 Answer 1

1

You should delegate event as following:

$('#all_order').on('click', 'a.success_btn',function(){
   /*( ͡° ͜ʖ ͡°)*/
});
Sign up to request clarification or add additional context in comments.

1 Comment

actuall #all_order is on another php page , so jquery function will not read this id I guess. Have updated my question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.