4

以下のajax関数のレスポンスをdom内のdivに表示したい(update div)。重いプラグインを使用せずにこれを行うにはどうすればよいですか。

url: 'http://dowmian.com/xs1/getcam.php',
type: 'GET',
data: {id: <?php echo $cam_id; ?>},
success: function(responseText){
},
error: function(responseText){
}
4

4 に答える 4

5

関数の戻り値によって異なりますが、おそらく関数getcam.phpを探しているでしょう。html()

$.ajax({
    url: 'http://dowmian.com/xs1/getcam.php',
    type: 'GET',
    data: {id: <?php echo $cam_id; ?>},
    success: function(responseText){
        $('#update-div').html(responseText);
    },
    error: function(responseText){
    }
});

#update-divajax-call の直前のように、動的に追加したい場合は、次のように実行できappend()ます。

$('.container').append($('<div/>').attr('id','update-div'));

参考文献

于 2012-04-28T09:31:26.410 に答える
1

成功の中で、これを行います:

success: function(responseText) {
    $("#target").text(responseText);
},
于 2012-04-28T09:29:11.183 に答える
0

これを試して:

success: function(responseText) {
    $("#update-div").text(responseText.d);
},

ここから詳細情報を取得できます

于 2012-04-28T09:31:09.783 に答える
0

あなたが持っている空の「成功」ハンドラ関数を活用してください。

于 2012-04-28T09:27:39.670 に答える