问题
I want to add Loaded html from Ajax request to Div with effect (for example slide down).
I am using this code but it doesn't have effect yet :
obj.html(msg.d).show('slow');
Is it possible ?
Update : this my full code:
$.ajax({
type: "POST",
url: options.webServiceName + "/" + options.renderUCMethod,
data: options.ucMethodJsonParams,
contentType: "application/json; charset=utf-8",
dataType: "json",
cache: true,
success:
function (msg) {
var html = msg.d;
obj.html(msg.d).show('slow');
// if specified make callback and pass element
if (options.completeHandler)
options.completeHandler(this);
},
error:
function (XMLHttpRequest, textStatus, errorThrown) {
if (options.errorHandler) {
options.errorHandler(this);
} else {
obj.html("error");
}
}
});
回答1:
Should work -- I assume that "obj" is a , you can try to split it up into two just to make sure you don't have anything funny going on.
$(obj).html(msg.d);
$(obj).show(500); // 500 ms animation time
回答2:
Yes, you can, but your object must be hidden initially, so do:
obj.hide().html(msg.d).show('slow');
Hope this helps. Cheers
来源:https://stackoverflow.com/questions/6606029/add-html-to-div-with-effect-jquery