hi
i think you'll find all the answers on the yui page
http://developer.yahoo.com/yui/connection/
here's a example how i'm using it:
Code:
var invites = {
init:function()
{
YAHOO.util.Event.removeListener("ajaxinvites", "click", invites.init);
YAHOO.util.Connect.asyncRequest("POST", "ajax.php?do=showinviteform", {
success: invites.initform,
failure: vBulletin_AJAX_Error_Handler,
timeout: vB_Default_Timeout
},SESSIONURL + "securitytoken=" + SECURITYTOKEN + "&do=showinviteform");
},
initform:function(a)
{
b = a.responseXML.getElementsByTagName("template")[0].firstChild.nodeValue;
t = YAHOO.util.Dom.get('ajaxinvites').innerHTML;
YAHOO.util.Dom.get('ajaxinvites').innerHTML = b;
YAHOO.util.Event.on('sendinvite', 'click', invites.send, this, true);
},
.....}
second example:
Code:
vBTwitter.prototype.senddirect = function(e)
{
YAHOO.util.Event.stopEvent(e);
YAHOO.util.Dom.get("progress_tweet").style.display='block';
YAHOO.util.Connect.asyncRequest("POST", "tweet.php?do=tweet", {
success: this.sended,
failure: vBulletin_AJAX_Error_Handler,
timeout: vB_Default_Timeout
},SESSIONURL + "securitytoken=" + SECURITYTOKEN + "&do=tweet&tweet=" + PHP.urlencode(YAHOO.util.Dom.get('twitter_tweet').value) ); // TODO need to check which function to use here to code msg
}
vBTwitter.prototype.sended = function(a)
{
var error = a.responseXML.getElementsByTagName("error")[0];
if (error)
{
YAHOO.util.Dom.get("progress_tweet").style.display='none';
alert(a.responseXML.getElementsByTagName("error")[0].firstChild.nodeValue);
}
else
{
YAHOO.util.Dom.get("progress_tweet").style.display='none';
YAHOO.util.Dom.get('twitter_tweet').value = '';
vBmenu.hide();
}
}
Maybe its not the best way to use it, but thats the way i'm using it and its working