Hi, here I have a very simple 'hello world' example that makes use of
Yahoo! User Interface Library. I have a problem with my response string
coming back as '[object, Object]'. I managed to check that everything
else works.
The requested 'SayHello.html' file only contains the string "hello,
world".
Here is my code:
<html>
<head>
<title>Hello World with YUI</title>
<script src="yahoo.js"></script>
<script src="connection.js"></script>
<script language="JavaScript" type="text/javascript">
var handleSuccess = function(o){
if(o.responseText !== undefined){
document.getElementById('span_result').innerHTML = o.responseText;
}
}
var handleFailure = function(o){
document.getElementById('span_result').innerHTML = 'ERROR: ' +
o.responseText;
}
var callback =
{
success:handleSuccess,
failure: handleFailure
};
</script>
</head>
<body>
<!-- Clicking this link initiates the asyncronous request -->
<a href="javascript:YAHOO.util.Connect.asyncRequest(' GET',
'SayHello.html', callback);">Say Hello</a><br>
<!-- used to display the results of the asyncronous request -->
<span id="span_result"></span>
</body>
</html>