Everything else on the exercise worked, except the last function, that tells the coffee is ready. When the timer finishes, the javascript errrors at the text-utils code :
Error: el.appendChild is not a function
Source File: http://www.luciana.pro.br/ajax/coffee/text-utils.js
Line: 5
------------- TEXT-UTILS.JS :
function replaceText(el, text) {
if (el != null) {
clearText(el);
var newNode = document.createTextNode(text);
el.appendChild(newNode); <<<<<<<<<<< THE ERROR REFERS TO THIS LINE
}
}
---------------------------------
------------ serveDrink FUNCTION :
function serveDrink()
{
// quando a cafeteira tiver terminado, serve a bebida
if( request.readyState == 4 )
{
if( request.status == 200 )
{
var response = request.responseText;
//descobre quem fez o pedido e de qual cafeteira veio
var maker = response.substring( 0, 1 ); // '2Jim'
var name = response.substring( 1, response.length );
if( maker == "1" )
{
document.getElementById( "coffeemaker1-status" );
replaceText( coffeemaker1-status, "Idle" );
}
else
{
document.getElementById( "coffeemaker2-status" );
replaceText( coffeemaker1-status, "Idle" );
}
alert( name + ", your coffee is ready!" );
}
else
{
alert( "Error! Request status is: " + request.status );
}
}
}
--------------------------------------------
ANY IDEA OF WHAT COULD IT BE ??
THANKS !
[]S











