zoukankan      html  css  js  c++  java
  • jQuery ajax使用$(this).parent()无效解决方法

    div=$(this).parent(); //先获取父级元素



    div.remove(); //再删除



    $(".delStu").click(function () {
                           td = $(this).parent().parent();
                           if (confirm("您确认删除么")) {
                               $.ajax({
                                   url: "/Demo/Student/DelStudent",
                                   type: "POST",
                                   data: { ID: $(this).attr('data-id') },
                                   success: function (data) {
                                       if(data.msg=="删除成功");
                                       {
                                           console.log(data);
                                           td.remove();
                                       }
                                   },
                                   error: function () {
                                       console.log("error");
                                   }
                               })


                           } else {
                               
                           }
                       });

  • 相关阅读:
    开始制作国产的 scratch
    七个对我最重要的职业建议(译文)
    不要在功能上竞争
    来看看机智的前端童鞋怎么防盗
    悬疑塑成天才?
    Linux常用命令之重启关机命令
    Linux常用命令之网络命令
    Linux常用命令之文件搜索命令
    Linux常见命令之权限管理命令
    Linux常见命令之文件处理命令
  • 原文地址:https://www.cnblogs.com/MartinLee/p/7622697.html
Copyright © 2011-2022 走看看