Sha*_*eKm 2 jquery asp.net-mvc-3
我需要有一个很好的过渡,我删除第一行并附加到表新项目.
$.getJSON('/Home/GetRecentPosts/', { count:1 }, function(data) {
$('#recentPosts tr:first').fadeOut(2000);
$('#recentPosts').append($('<tr><td>'+data[0].SchoolName+'</td></tr>').hide().fadeIn(2000));
});
Run Code Online (Sandbox Code Playgroud)
这是第一次我只执行getJson.请帮忙.谢谢
我试图将您想要的每个功能项分成一个单独的行.如果这不是您所追求的,那么希望不应该很难调整以下代码以满足您的需求.
$.getJSON(
'/Home/GetRecentPosts/',
{ count:1 },
removeFirstRowAndAppendNewItem(data)
);
function removeFirstRowAndAppendNewItem(data)
{
console.log("in callback"); // to confirm we have reached here
$('#recentPosts tr:first').fadeOut(2000, function() {
$('#recentPosts tr:first').remove();
newRow = $('<tr><td>'+data[0].SchoolName+'</td></tr>').hide();
$('#recentPosts').append(newRow)
newRow.fadeIn(2000));
});
}
Run Code Online (Sandbox Code Playgroud)
基本上:
(注意:可以将这些步骤组合在一起)
| 归档时间: |
|
| 查看次数: |
6912 次 |
| 最近记录: |