SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы
Список вопросов ПечатьМетки: jquery javascript bootstrap
| RemiZOffAlex Создано: 2017-12-02 20:10:36.554475 Обновлено: 2017-12-02 20:10:36.554475 |
|---|
<div class="card">
<div class="card-header">Уведомления</div>
<div class="card-body">
{% for notify in pagedata['notifications'] %}
<div id="notify{{ notify.id }}" class="alert alert-{{ {'info': 'info', 'debug': 'secondary', 'warning': 'warning', 'danger': 'danger'}[notify.level] }}" role="alert">
<a class="float-right" id="notifyRemove{{ notify.id }}" data-id="{{ notify.id }}"><i class="fa fa-remove"></i></a>
{{ notify.message|safe }}
</div>
{% endfor %}
</div>
</div>
<script type="text/javascript">
$( "[id^='notifyRemove']" ).click(function( event ) {
var id = $( this ).data( 'id' );
$.get( "/notify/" + id, function(returnedData) {
$( "#notify" + id ).remove();
});
})
</script>
|