<div class="left">
<div class="navLeft mv_10" id="navList">
<a href="/article"
class="${empty currentCateId ? 'in_block current' : ''}">全部类别</a>
<c:forEach var="category" items="${categories}">
<a href="/article?cateId=${category.id}"
class="${currentCateId == category.id ? 'in_block current' : ''}">${category.name}</a>
</c:forEach>
</div>
a href="#" class="ml_5 btnOpH24 h24Silver in_block mr_10 mt_10 js_edit"
id="addType"> + 添加类别</a>
</div>
<!-- 这里是用来提交的添加类别的 -->
<div class="popLayer" id="editPopupLayer">
<div class="popTitle clearfix">
<h1 class="ml_10 mt_15">添加类别</h1>
<div class="cls">
<a href="#" class="xx"
οnclick="hidePopupDiv($('#editPopupLayer')); return false;"></a>
</div>
</div>
<div class="popCon">
<div class="form center">
<input type="text" name="newValue" id="commentContent">
</div>
</div>
<form action="" name="commented" method="get">
<div class="popBtn">
<a href="#" class="btnOpH24 h24Silver in_block ml_5"
οnclick="hidePopupDiv($('#editPopupLayer')); return false;">取消</a> <a
href="#" class="ml_5 btnOpH24 h24Blue in_block" id="saveEdit">提交</a>
</div>
</form>
</div>
<script type="text/javascript">
$(function() {
var clickObj = null;
$('a.js_edit').click(function() {
showPopupDiv($('#editPopupLayer'));
clickObj = $(this);
$("#commentContent").val();
});
$('#saveEdit').click(
function() {
var commentEdit = $("#commentContent").val();
var url = '/category/add/'+ commentEdit;
ajaxPut({
url : url,
ok : function(data) {
if (data.status == 'ok') {
$('#navList').html($('#navList').html()+'<a href="/article?cateId='+data.category.id+'">'+data.category.name+'</a>');
}
},
fail : function(data) {
alert(data.message);
}
});
clickObj.closest('div').find('.js_comment').text(
$('[name=newValue]').val());
hidePopupDiv($('#editPopupLayer'));
});
});
</script>