首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

新学者求教jQuery post有关问题。

2013-08-16 
新学者求教jQuery post问题。。$(.delete).click(function () {if (confirm(您确实要删除该信息么?)) {v

新学者求教jQuery post问题。。

$('.delete').click(function () {
            if (confirm("您确实要删除该信息么?")) {
                var id = $(this).parents('tr:first').attr('id');
                gAjax.delete_teach(id, function (r) {
                    if (r == 1) { alert("删除成功"); }
                    else {
                        alert("删除失败");
                    }
                    $('#' + id).fadeOut(200, function () { $(this).remove(); });
                });
            }
            return false;

        });


这个代码如何用jQuery ajax - post() 方法实现?  jQuery jQuery?Ajax JavaScript
[解决办法]
引用:
$('.delete').click(function () {
            if (confirm("您确实要删除该信息么?")) {
                var id = $(this).parents('tr:first').attr('id');
                gAjax.delete_teach(id, function (r) {
                    if (r == 1) { alert("删除成功"); }


                    else {
                        alert("删除失败");
                    }
                    $('#' + id).fadeOut(200, function () { $(this).remove(); });
                });
            }
            return false;

        });



这个代码如何用jQuery ajax - post() 方法实现? 

里面换成这样
 $.post("asd.ashx", { id: id, dat: Math.random() }, function (r) {

            if (r == 1) { alert("删除成功"); }
            else {
                alert("删除失败");
            }
            $('#' + id).fadeOut(200, function () { $(this).remove(); });
        
         })
    

post到asd.ashx这个一般处理程序(其他的也可以)

热点排行