I am trying to bring in some effects on a div after an ajax call. This is my jQuery for ajax, ajax works very well but none of effects I try to bring in here from script. How do I make it possible? I want the new data to be shown in a div with a slideDown effect.
function item_submit(){
$('#item_item_button').click(function() {
$.ajax({
type: 'POST',
url: "/item/create",
data: $('#create_item').serialize(),
error: function(){ },
success: function(data) {
$("#item_form").hide();
$('#view_item').html(data);
},
complete: function() {
$('#view_item').slideDown();
}
});
return false;
});
}
Try with below code:
function item_submit(){
$('#item_item_button').click(function() {
$.ajax({
type: 'POST',
url: "/item/create",
data: $('#create_item').serialize(),
error: function(){ },
success: function(data) {
$('#item_form').before(data);
$('#view_item').hide().slideDown('slow');
}
});
return false;
});
}