• I want to auto refresh contents of html table when Save Button is clicked with the list of arrays that returned from ajax and stored in “data1”. The Code is as shown below :

    $('#btnsave').on('click',function(){
              $.ajax({
            type: 'POST',
            url: '<?php bloginfo('template_url');?>/orderunpaidUpdt.php',
            data: data,
            cache: false,
            success: function(data){
              console.log(data);
              setTimeout(refreshTable, 1000);
            }
              });
           });
    
        function refreshTable() {
          var data1 = new Array();
          $.ajax({
            type: 'POST',
            url: '<?php bloginfo('template_url');?>/orderunpreload.php',
            success: function(data1){
                console.log(data1);
                $('#tabstatusdisp').find('tbody').empty().append('<tr><td>$row['t_ordid']<\/td><td>$row['label_date']<\/td><td>
        $row['u_name']<\/td><td>$row['scat_name']<\/td><td>$row['lbl_qty']<\/td><td>$row['lbl_prc']<\/td><td>$row['pay_flag']<\/td><td>$row
       ['stat_desc']<\/td><td>$row['file_path']<\/td></tr>');
            }
          });

    data1 : [ arrays As shown in Javascript Console ]

    array(0) {
    }
    ?Array
    (
        [0] => Array
            (
                [t_ordid] => 1
                [label_date] => 23-01-2015
                [u_name] => Rahul Dev
                [scat_name] => Christmas
                [lbl_qty] => 1
                [lbl_prc] => 5.95
                [pay_flag] => N
                [stat_desc] => UnPaid
                [file_path] => savelabel/canvas23012015061906.png
            )
    
        [1] => Array
            (
                [t_ordid] => 2
                [label_date] => 23-01-2015
                [u_name] => Suneet Pant
                [scat_name] => Fathers Day
                [lbl_qty] => 1
                [lbl_prc] => 5.95
                [pay_flag] => N
                [stat_desc] => UnPaid
                [file_path] => savelabel/canvas23012015062012.png
            )
    
        [2] => Array
            (
                [t_ordid] => 3
                [label_date] => 23-01-2015
                [u_name] => Suneet Pant
                [scat_name] => Christmas
                [lbl_qty] => 1
                [lbl_prc] => 5.95
                [pay_flag] =>
                [stat_desc] => UnPaid
                [file_path] => savelabel/canvas23012015063120.png
            )
    
        [3] => Array
            (
                [t_ordid] => 4
                [label_date] => 29-01-2015
                [u_name] => Suneet Pant
                [scat_name] => Christmas
                [lbl_qty] => 1
                [lbl_prc] => 5.95
                [pay_flag] => N
                [stat_desc] => UnPaid
                [file_path] => savelabel/canvas29012015060849.png
            )
    
        [4] => Array
            (
                [t_ordid] => 5
                [label_date] => 29-01-2015
                [u_name] => Rahul Dev
                [scat_name] => Christmas
                [lbl_qty] => 1
                [lbl_prc] => 5.95
                [pay_flag] => N
                [stat_desc] => UnPaid
                [file_path] => savelabel/canvas29012015061712.png
            )
    )

    Now the problem is how to put the above list of arrays back to html table.

    Pls help??

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘how to auto refresh html table contents when save button is clicked in jquery ph’ is closed to new replies.