on success replace class div ajax

JavaScript
$(selector).replaceWith(content,function(index))

//example
$('alert').replaceWith('alert alert-success')
//or
$('alert').addClass('alert-succes')
Source

Also in JavaScript: