<script type="text/javascript"> $('button .btn,.btn-primary,.btn-sm').on('click', function() { var urlRe= $(this).children("input:first-child").val(); //获取第一个子代的数值 也是多个类作为筛选条件 var that = $(this); //在ajax成功返回之后使用 $.ajax({ url:urlRe, type:'get', dataType:'json', error: function(res) { alert(res.msg); }, success: function(res) { if (res.status != 0 ) { alert(res.msg); } else { var rebuildObj = that.parent().prev().prev().children('span:first-child'); rebuildObj.text('生成中'); rebuildObj.removeClass("label label-danger"); rebuildObj.addClass('label label-info'); that.remove(); } } }); }); </script>