xhr.html revision 1b298c6f0ef597aa4ab0b8bcb25430b6c9a87749
<html>
<head>
<title>Connection Manager GET Transaction</title>
/*margin and padding on body element
can introduce errors in determining
element position and are not recommended;
we turn them off as a foundation for YUI
CSS treatments. */
body {
margin:0;
padding:0;
}
</style>
<!--begin custom header content for this example-->
<style>
#container li {margin-left:2em;}
</style>
<!--end custom header content for this example-->
</head>
<body class=" yui-skin-sam">
<h1>Connection Manager GET Transaction</h1>
<div class="exampleIntro">
<p>To create a GET transaction using <a href="http://developer.yahoo.com/yui/connection/">Connection Manager</a>, you will need to construct a querystring of key-value pairs and append it to the URL.
The following code example provides a step-by-step approach to creating a simple GET transaction.</p>
<p>Click "Send a GET Request" below to try it out, then read the description below to learn how to create a simple transaction using Connection Manager.</p>
</div>
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
<div id="container"></div>
<script>
var Y = YUI().use('dump', 'io');
var div = Y.get('#container');
var handleSuccess = function(id, o){
Y.log("The success handler was called. tId: " + Y.Lang.dump(Y.Array(arguments)) + ".", "info", "example");
if(o.responseText !== undefined){
// " [bar] => " + o.argument.bar +" )</li>";
}
}
var handleFailure = function(id, o){
if(o.responseText !== undefined){
}
}
var callback =
{
on: {
success:handleSuccess,
failure:handleFailure
},
argument: { foo:"foo", bar:"bar" }
};
function makeRequest(){
var request = Y.io(sUrl, callback, 'asd');
Y.log("Initiating request; tId: " + Y.Lang.dump(request) + ".", "info", "example");
}
Y.on('io:success', function() {
});;
Y.log("As you interact with this example, relevant steps in the process will be logged here.", "info", "example");
</script>
<form><input type="button" value="Send a GET Request" onClick="makeRequest();"></form>
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
</body>
</html>