Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
    <head>
<meta name="description" content="Ajax DataTable">
        <link href="//datatables.net/download/build/nightly/jquery.dataTables.css" rel="stylesheet" type="text/css" />
  
        <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
        <script src="//datatables.net/download/build/nightly/jquery.dataTables.js"></script>
        <meta charset=utf-8 />
        <title>DataTables - delete Row</title>
    </head>
    <body>
        <div class="container">
            <table id="example" class="display" width="100%">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Position</th>
                        <th>Office</th>
                        <th>Age</th>
                        <th>Start date</th>
                        <th>Salary</th>
                        <th>Button</th>
                    </tr>
                </thead>
            </table>
        </div>
    </body>
</html>
 
$(document).ready(function() {
    var table = $('#example').dataTable( {
        "ajax":{
            url:"//jsbin.com/zezakap/3.json",
            dataType:"json",
            error:function(err){debugger;}
        },
        "columns": [
            { "data": "name" },
            { "data": "position" },
            { "data": "office" },
            { "data": "extn" },
            { "data": "start_date" },
            { "data": "salary" },
            { "data": null, render:function(){
                return "<button type='button'>Del</button>"
            }}
        ]
    } );
    
    $("#example").on("click", "button", function(){
        var $tr = $(this).closest("tr");
        $("#example").DataTable().rows($tr).remove().draw();
    });
} );
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
bindridpro
0viewers