【发布时间】:2013-07-28 18:19:18
【问题描述】:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
var commentUrl = 'comment.jsp';
$('.privateTimeline').click(function() {
$.ajax({
url: commentUrl,
type:'post',
data:{
no : $(this).find('.no').text() // working!
},
success:function(data){
if( $(this).children('.comment').is(':hidden') ) { // not working!
$(this).find('.comment').slideDown(400); // not working!
$(this).find('.comment').html(data); // not working!
}
else {
$(this).find('.comment').slidUp(400); // not working!
}
});
})
</script>
- 我不知道这段代码不起作用的原因。
- 我想选择 privateTimeline 的子类节点,所以创建事件。
- 在成功函数部分不起作用,但 $(this) 在数据部分起作用。
【问题讨论】: