<script>
function getNameList(){
$.getJSON('/Namelist',function(res){
var content=''
$.each(res,function(k,v){
content += '<tr>'
content += '<td>'+v[0]+'</td>'
content += '<td>'+v[1]+'</td>'
content += '<td> <button data-name="'+v[0]+'" class="delete-btn btn btn-default">delete</button></td>'
content += '</tr>'
})
$('#name-list').html(content)
})
}
getNameList()
$(document).on('click','.detele-btn',function(){
var name=$(this).attr('data-name')
$.get('/daleteName?name='+name,function(res){
if(res=='ok'){
getList()
}
})
})
</script>