When a user post a status, I show it at the top of the feed page. I want to add it a fadeIn effect, but the script I wrote hides all the updates and shows again. I want this apply to only the latest status.
What's wrong with it?
HTML
<div class="col-md-12" id="sharing">
</div>
JS
$("#sharenow").click(function () {
var formData = {
'text': $("#update-text").val()
};
$("#update-text").val('');
$.ajax({
type: 'POST',
url: '/newstatus',
data: formData,
dataType: 'json',
encode: true
})
.done(function (data) {
if (data.success) {
$("#sharing").prepend('<div class="row posts">'+data.comment+'</div>').hide().fadeIn(1500);
}
});
});
});