Ajax.Request对象在任何一个阶段都可以调用你自定义的方法,形式如onxxxxxxx:yourfunction,比如我们上面提到的onComplete,是最常用的。
function sends(id)
{
c = $('content');
o = $('old-content');
c.innerHTML = "
载入中...
";
o.innerHTML = c.innerHTML;
c.style.display = 'none';
o.style.display = 'block';
var myAjax = new Ajax.Request('content_' id '.html', {method: 'get', onComplete:updates});
}
function updates(response)
{
new Effect.Fade($('old-content'));
new Effect.Appear($('content'));
$('content').innerHTML = response.responseText;
}