实现网页与数据库的连接,并进行数据删除操作

本文介绍如何使用VS Code进行网页与数据库的连接,并详细解析代码,实现数据删除操作。通过jQuery动态生成DOM,利用事件代理提高效率,结合console.log()进行调试。
摘要由CSDN通过智能技术生成

实现网页与数据库的连接,并进行删除操作

今天主要使用VS Code编写代码,接下来会对代码进行详细解读,以下为源代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>动态表格</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <style>
        /* 标签选择器 */
        table{
   
            border: 1px solid #444;
            /* 合并边框 */
            border-collapse: collapse;
            width: 400px;
            text-align: center;
        } 
        td,th{
   border: 1px solid #444;}   
    </style>
    <script>
        //设置基础路径
        var baseURL = 'http://localhost:8899';
        //事件代理
        $(function(){
   
            $('tbody').on('click','button',function(event){
   
                console.log(this);
                // console.log(event.target);
                // console.log(event.currentTarget);
                console.log($(this));
                // console.log(this.flag);
                // console.log($(this).attr('flag'));
                var id = $(this).attr('flag')
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值