Generate Alert From Bootstrap With JQUERY

0

I try to send an ajax request which I need when I return the answer in the .done (function (- > answer < -) {

How can I make that validation in the donation so that this "alert" appears in my view? thanks

    
asked by JDavid 11.01.2017 в 14:26
source

1 answer

1

It would be good if you add a bit of your code or explain it better, maybe it is not clear. In any case, if all you want is to add a bootstrap alert inside your answer, all you have to do is create the div with the classes.

$.ajax({
//tu configuración ajax [...]
}).done(function(resp){
tpl = '<div class="alert alert-warning">'+resp+'</div>';
$('.contenedor').html(tpl) //puedes usar before o after si lo quieres posicionar con respecto a otro elemento

});

If I understood your question well, that would be what you need. the element ".container" I put it to suppose, there would go the element on which you want to add the message.

    
answered by 11.01.2017 / 14:50
source