I have put together the following mootools script
window.addEvent(\'domready\', function() {
var shouts = \"timed.php\";
var log = $(\'log_res\');
f
Can you not do something like this:
function updateData (url, target)
{
var target = $(target);
target.innerHTML = 'Please wait...';
//and the rest of the function
}
With MooTools 1.2, this works as requested:
function updateData (url, target)
{
var target = $(target);
target.empty().addClass('ajax-loading');
target.innerHTML = "Loading...";
new Request({
url: url,
method: 'get',
onComplete: function(responseText) {
target.removeClass('ajax-loading');
target.innerHTML = responseText;
}
}).send();
}
Since you are no fun and use MooTools 1.1, I must dig a little... Actually, I got it working using nearly the same setup as you have (notice I use target
instead of log
, which was defined outside of the scope of this function):
function updateData (url, target)
{
var target = $(target);
target.empty().addClass('ajax-loading');
target.innerHTML = "Loading...";
new Ajax(url, {
method: 'get',
update: target,
onComplete: function() {
target.removeClass('ajax-loading');
}
}).request();
}