以下の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){
}
以下の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){
}
関数の戻り値によって異なりますが、おそらく関数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-div
ajax-call の直前のように、動的に追加したい場合は、次のように実行できappend()
ます。
$('.container').append($('<div/>').attr('id','update-div'));
参考文献:
成功の中で、これを行います:
success: function(responseText) {
$("#target").text(responseText);
},
あなたが持っている空の「成功」ハンドラ関数を活用してください。