Skip to content

Instantly share code, notes, and snippets.

@apipkin
Forked from anonymous/gist:700521
Created November 15, 2010 16:17
Show Gist options
  • Select an option

  • Save apipkin/700532 to your computer and use it in GitHub Desktop.

Select an option

Save apipkin/700532 to your computer and use it in GitHub Desktop.
// Ajax event request handler
SendAjaxRequest = function(Event)
{
YUI().use(
"io-base", "json",
function(Y)
{
var myScriptEvent = escape(Y.JSON.stringify(Event));
Y.io("http://localhost/ScriptHandler.php?ScriptEvent=" + myScriptEvent, {
method: "POST",
on : {
complete : Y.bind(HandleAjaxResponse, Y)
}
});
}
);
}
YUI().use('myWidget', function(Y){
var myWidget = new MyWidget({render:true});
myWidget.on('custom:event', Y.bind(SendAjaxRequest, this));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment