jQuery:无法使用$ .post更新div中的文本

时间:2014-07-12 19:03:15

标签: jquery

我正在尝试在div中显示一些文字。此div会在页面上多次显示,因此无需定位ID。

这样做:它会在div中显示消息。

$('.join-div .content a').click(function() {
    $(this).parent().siblings('.message').html('THIS IS A TEST');
});

这不是

$('.join-div .content a').click(function() {

    var data = 'foo=bar';

    $.post('/assets/ajax/join.php',data, function(response) {
        $(this).parent().siblings('.message').html('THIS IS A TEST');
    });
});

我在控制台中没有收到任何错误,php脚本有效;它返回一个响应,我可以alert()它。看起来$.post正在以某种方式干扰,但我无法弄明白。

0 个答案:

没有答案