笨小孩做开发

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

  //触发删除的动作
                $("a.delete").live('click', function () {
                    var id = $(this).data('lpprojecttemplateid');
                    if(confirm("是否确认删除?"))
                    {
                  
                        $.ajax({
                            url: "/api/LPProjectTemplate/" + id,
                            type: 'DELETE',
                            cache: false,
                            //statusCode: {
                            //    204:
                            //        function (data) {
                            //            self.allLPProjectTemplate.remove(function (userinfo) {
                            //                return userinfo.LPProjectTemplateID == id;
                            //            })

                            //        }
                            //}
                            success: function (result) {
                                self.allLPProjectTemplate.remove(function (result) {
                                    return result.LPProjectTemplateID == id;
                                })
                          
                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                alert("出錯了");
                            }

                        });
                    }
                });

posted on 2013-07-17 14:27  笨小孩做开发  阅读(254)  评论(0编辑  收藏  举报