0

我想用 Jquery $.POST() 发布一个表单值并加载一个我不知道该怎么做的特定选择器可能是用 json 或类似的东西

$.post('topic.php', {id: id}, function(data){
    $("#message").html(data);
    $("#message").hide();
    $("#message").slideDown(500); //Fade in the data given by the topic.php file
});

我只想加载标题和描述而不是整个页面

我想在灯箱中检索此标题和描述,我该怎么做?

4

2 回答 2

1

也许这会有所帮助:

$.post('topic.php', {id: id}, function(data){
    $("#message").html($(data).find("#your_dom_selector"));
    ...
}
于 2012-11-21T09:29:06.573 回答
0
$.post('topic.php', {
    id: id
}, function(data) {
    $("#message")
        .html($(data).('attr', 'title'))
        .hide()
        .slideDown(500); //Fade in the data given by the topic.php file
});
return false;
});​
于 2012-11-21T09:30:15.127 回答