は、私はこのような通知ボックスを作成しようとしている:あなたが見たようJS(またはjQuery)でdivに画像を設定するにはどうすればよいですか?
は、非表示コンテンツのロードになり、その上に画像.gif
あります。今、私は<div>
に次の画像を追加したい:ここ
は私のAjaxコードです:
$(".notifications_list").html(/* add this path: /myfolder/img/progress.gif */);
$(".notifications_list").html(/* remove progress.gif photo */);
どのようにすることができます:
function notification(){
$(".notifications_list").html(/* add this path: /myfolder/img/progress.gif */);
$.ajax({
url : '/myweb/files/notification.php',
dataType : 'JSON',
success : function (notification_system) {
$(".notifications_list").html(/* remove progress.gif photo */);
if(notification_system.success === 1){
$(".notifications_list").html(notification_system.notifications);
} else {
alert('something is wrong');
}
}
});
}
次の2行に焦点を当ててください。それを行う?つまり、HTMLへのパスで画像を追加して削除するにはどうすればいいですか?
を削除するには、コンテナのdivに画像を付加し、画像Aを与えることができますカスタムCSSクラス/ ID。それを削除したいときは、そのクラス/ idを削除してください。 – Jecoms