|
525
|
1 |
<!DOCTYPE html> |
|
|
2 |
<html lang="en"> |
|
|
3 |
<head> |
|
|
4 |
<meta charset="utf-8"> |
|
|
5 |
<title>Example: HTTP GET to request data</title> |
|
|
6 |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic"> |
|
|
7 |
<link rel="stylesheet" href="../../build/cssgrids/cssgrids-min.css"> |
|
|
8 |
<link rel="stylesheet" href="../assets/css/main.css"> |
|
|
9 |
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css"> |
|
|
10 |
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png"> |
|
|
11 |
<script src="../../build/yui/yui-min.js"></script> |
|
|
12 |
|
|
|
13 |
</head> |
|
|
14 |
<body> |
|
|
15 |
<!-- |
|
|
16 |
<a href="https://github.com/yui/yui3"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a> |
|
|
17 |
--> |
|
|
18 |
<div id="doc"> |
|
|
19 |
<div id="hd"> |
|
|
20 |
<h1><img src="http://yuilibrary.com/img/yui-logo.png"></h1> |
|
|
21 |
</div> |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
<h1>Example: HTTP GET to request data</h1> |
|
|
25 |
<div class="yui3-g"> |
|
|
26 |
<div class="yui3-u-3-4"> |
|
|
27 |
<div id="main"> |
|
|
28 |
<div class="content"><style type="text/css" scoped> |
|
|
29 |
#container li {margin-left:2em;} |
|
|
30 |
#container { background-color:#FFFFFF; border:1px dotted #666666; padding:1em; margin-bottom:1em;} |
|
|
31 |
</style> |
|
|
32 |
<div class="intro"> |
|
|
33 |
<p>This example demonstrates how to send HTTP GET requests using <a href="http://developer.yahoo.com/yui/3/io/" title="YUI 3: IO">YUI 3's IO module</a>. One transaction uses global event listeners to handle the transaction's lifecycle and response. The other transaction uses both global and transaction-level events.</p> |
|
|
34 |
</div> |
|
|
35 |
<div class="example"> |
|
|
36 |
<div id="container"> |
|
|
37 |
<ul> |
|
|
38 |
<li>IO GET response data will appear here.</li> |
|
|
39 |
</ul> |
|
|
40 |
</div> |
|
|
41 |
<form> |
|
|
42 |
<input id="get1" type="button" value="GET with Global Listeners. " /> |
|
|
43 |
<input id="get2" type="button" value="GET with Global and Transaction Listeners" /> |
|
|
44 |
</form> |
|
|
45 |
|
|
|
46 |
<script> |
|
|
47 |
YUI().use("io-base", "node", |
|
|
48 |
|
|
|
49 |
function(Y) { |
|
|
50 |
|
|
|
51 |
//Get a reference to the DIV that we are using |
|
|
52 |
//to report results. |
|
|
53 |
var d = Y.one('#container'), |
|
|
54 |
gStr = '', |
|
|
55 |
tStr = '', |
|
|
56 |
state; |
|
|
57 |
|
|
|
58 |
/* global listener object */ |
|
|
59 |
var gH = { |
|
|
60 |
write: function(s, args) { |
|
|
61 |
gStr += "ID: " + s; |
|
|
62 |
if (args) { |
|
|
63 |
gStr += " " + "The globally-defined arguments are: " + args; |
|
|
64 |
} |
|
|
65 |
gStr += "<br>"; |
|
|
66 |
}, |
|
|
67 |
start: function(id) { |
|
|
68 |
// When transaction listeners are handled, its user-defined arguments |
|
|
69 |
// are accessible in the arguments collection. The following detection |
|
|
70 |
// logic determines whether the output should account for transaction |
|
|
71 |
// arguments. |
|
|
72 |
args = state === 'global' ? arguments[1] : arguments[2]; |
|
|
73 |
this.write(id + ": Global Event Start.", args); |
|
|
74 |
}, |
|
|
75 |
complete: function(id, o) { |
|
|
76 |
args = state === 'global' ? arguments[2] : arguments[3]; |
|
|
77 |
this.write(id + ": Global Event Complete. The status code is: " + o.status + ".", args); |
|
|
78 |
}, |
|
|
79 |
success: function(id, o) { |
|
|
80 |
args = state === 'global' ? arguments[2] : arguments[3]; |
|
|
81 |
this.write(id + ": Global Event Success. The response is: " + o.responseText + ".", args); |
|
|
82 |
}, |
|
|
83 |
failure: function(id, o) { |
|
|
84 |
args = state === 'global' ? arguments[2] : arguments[3]; |
|
|
85 |
this.write(o + ": Global Event Failure. The status text is: " + o.statusText + ".", args); |
|
|
86 |
}, |
|
|
87 |
end: function(id) { |
|
|
88 |
args = state === 'global' ? arguments[1] : arguments[2]; |
|
|
89 |
this.write(id + ": Global Event End.", args); |
|
|
90 |
if (state === 'global') { |
|
|
91 |
flush(gStr); |
|
|
92 |
} |
|
|
93 |
} |
|
|
94 |
}; |
|
|
95 |
/* end global listener object */ |
|
|
96 |
|
|
|
97 |
/* transaction event object */ |
|
|
98 |
var tH = { |
|
|
99 |
write: function(s, args) { |
|
|
100 |
tStr += "ID: " + s; |
|
|
101 |
if (args) { |
|
|
102 |
tStr += " " + "The arguments are: " + args; |
|
|
103 |
} |
|
|
104 |
tStr += "<br>"; |
|
|
105 |
}, |
|
|
106 |
start: function(id, args) { |
|
|
107 |
this.write(id + ": Transaction Event Start.", args.start); |
|
|
108 |
}, |
|
|
109 |
complete: function(id, o, args) { |
|
|
110 |
this.write(id + ": Transaction Event Complete. The status code is: " + o.status + ".", args.complete); |
|
|
111 |
}, |
|
|
112 |
success: function(id, o, args) { |
|
|
113 |
this.write(id + ": Transaction Event Success. The response is: " + o.responseText + ".", args.success); |
|
|
114 |
}, |
|
|
115 |
failure: function(id, o, args) { |
|
|
116 |
this.write(id + ": Transaction Event Failure. The status text is: " + o.statusText + ".", args.failure); |
|
|
117 |
}, |
|
|
118 |
end: function(id, args) { |
|
|
119 |
this.write(id + ": Transaction Event End.", args.end); |
|
|
120 |
flush(gStr + tStr); |
|
|
121 |
} |
|
|
122 |
}; |
|
|
123 |
/* end transaction event object */ |
|
|
124 |
|
|
|
125 |
/* Output the results to the DIV container */ |
|
|
126 |
function flush(s) { |
|
|
127 |
d.set("innerHTML", s); |
|
|
128 |
if (state === 'global') { |
|
|
129 |
gStr = ''; |
|
|
130 |
} |
|
|
131 |
else { |
|
|
132 |
gStr = ''; |
|
|
133 |
tStr = ''; |
|
|
134 |
} |
|
|
135 |
} |
|
|
136 |
|
|
|
137 |
/* attach global listeners */ |
|
|
138 |
Y.on('io:start', gH.start, gH, 'global foo'); |
|
|
139 |
Y.on('io:complete', gH.complete, gH, 'global bar'); |
|
|
140 |
Y.on('io:success', gH.success, gH, 'global baz'); |
|
|
141 |
Y.on('io:failure', gH.failure, gH); |
|
|
142 |
Y.on('io:end', gH.end, gH, 'global boo'); |
|
|
143 |
/* end global listener binding */ |
|
|
144 |
|
|
|
145 |
/* configuration object for transactions */ |
|
|
146 |
var cfg = { |
|
|
147 |
on: { |
|
|
148 |
start: tH.start, |
|
|
149 |
complete: tH.complete, |
|
|
150 |
success: tH.success, |
|
|
151 |
failure: tH.failure, |
|
|
152 |
end: tH.end |
|
|
153 |
}, |
|
|
154 |
context: tH, |
|
|
155 |
headers: { 'X-Transaction': 'GET Example'}, |
|
|
156 |
arguments: { |
|
|
157 |
start: 'foo', |
|
|
158 |
complete: 'bar', |
|
|
159 |
success: 'baz', |
|
|
160 |
failure: 'Oh no!', |
|
|
161 |
end: 'boo' |
|
|
162 |
} |
|
|
163 |
}; |
|
|
164 |
/* end configuration object */ |
|
|
165 |
|
|
|
166 |
function call(e, b) { |
|
|
167 |
if (b) { |
|
|
168 |
state = 'all'; |
|
|
169 |
} |
|
|
170 |
else { |
|
|
171 |
state = 'global'; |
|
|
172 |
} |
|
|
173 |
|
|
|
174 |
Y.io('../assets/io/get.txt', cfg); |
|
|
175 |
} |
|
|
176 |
|
|
|
177 |
Y.on('click', call, "#get1", Y, false); |
|
|
178 |
Y.on('click', call, "#get2", Y, true); |
|
|
179 |
}); |
|
|
180 |
</script> |
|
|
181 |
|
|
|
182 |
</div> |
|
|
183 |
|
|
|
184 |
<h2 class="first">Using IO for HTTP GET Requests, and Handling the Response via Event Listeners.</h2> |
|
|
185 |
<h3>Create a YUI Instance</h3> |
|
|
186 |
<p>We create a YUI instance and use <code>io-base</code> for this example, since we only need to basic IO functionality:</p> |
|
|
187 |
|
|
|
188 |
<pre class="code prettyprint">//Create a YUI instance including support for IO: |
|
|
189 |
YUI({ filter:'raw' }).use("io-base", "node", function(Y) { |
|
|
190 |
// Y is the YUI instance. |
|
|
191 |
// The rest of the following code is encapsulated in this |
|
|
192 |
// anonymous function. |
|
|
193 |
} );</pre> |
|
|
194 |
|
|
|
195 |
|
|
|
196 |
<h3>Create Handlers for Global and Transaction Events</h3> |
|
|
197 |
|
|
|
198 |
<p> |
|
|
199 |
We will create one object to handle the Global Events, and one object to handle Transaction Events. Each object defines methods to handle the events in a transction's lifecycles. |
|
|
200 |
The results are logged to <code><div id="container"></code>. |
|
|
201 |
</p> |
|
|
202 |
|
|
|
203 |
<pre class="code prettyprint">//Get a reference to the DIV that we are using |
|
|
204 |
//to report results. |
|
|
205 |
var d = Y.one('#container'), |
|
|
206 |
gStr = '', |
|
|
207 |
tStr = '', |
|
|
208 |
state; |
|
|
209 |
|
|
|
210 |
/* global listener object */ |
|
|
211 |
var gH = { |
|
|
212 |
write: function(s, args) { |
|
|
213 |
gStr += "ID: " + s; |
|
|
214 |
if (args) { |
|
|
215 |
gStr += " " + "The arguments are: " + args; |
|
|
216 |
} |
|
|
217 |
gStr += "<br>"; |
|
|
218 |
}, |
|
|
219 |
start: function(id, args) { |
|
|
220 |
this.write(id + ": Global Event Start.", args); |
|
|
221 |
}, |
|
|
222 |
complete: function(id, o, args) { |
|
|
223 |
this.write(id + ": Global Event Complete. The status code is: " + o.status + ".", args); |
|
|
224 |
}, |
|
|
225 |
success: function(id, o, args) { |
|
|
226 |
this.write(id + ": Global Event Success. The response is: " + o.responseText + ".", args); |
|
|
227 |
}, |
|
|
228 |
failure: function(id, o, args) { |
|
|
229 |
this.write(o + ": Global Event Failure. The status text is: " + o.statusText + ".", args); |
|
|
230 |
}, |
|
|
231 |
end: function(id, args) { |
|
|
232 |
this.write(id + ": Global Event End.", args); |
|
|
233 |
if (state === 'global') { |
|
|
234 |
flush(gStr); |
|
|
235 |
} |
|
|
236 |
} |
|
|
237 |
}; |
|
|
238 |
/* end global listener object */ |
|
|
239 |
|
|
|
240 |
/* transaction event object */ |
|
|
241 |
var tH = { |
|
|
242 |
write: function(s, args) { |
|
|
243 |
tStr += "ID: " + s; |
|
|
244 |
if (args) { |
|
|
245 |
tStr += " " + "The arguments are: " + args; |
|
|
246 |
} |
|
|
247 |
tStr += "<br>"; |
|
|
248 |
}, |
|
|
249 |
start: function(id, args) { |
|
|
250 |
this.write(id + ": Transaction Event Start.", args.start); |
|
|
251 |
}, |
|
|
252 |
complete: function(id, o, args) { |
|
|
253 |
this.write(id + ": Transaction Event Complete. The status code is: " + o.status + ".", args.complete); |
|
|
254 |
}, |
|
|
255 |
success: function(id, o, args) { |
|
|
256 |
this.write(id + ": Transaction Event Success. The response is: " + o.responseText + ".", args.success); |
|
|
257 |
}, |
|
|
258 |
failure: function(id, o, args) { |
|
|
259 |
this.write(id + ": Transaction Event Failure. The status text is: " + o.statusText + ".", args.failure); |
|
|
260 |
}, |
|
|
261 |
end: function(id, args) { |
|
|
262 |
this.write(id + ": Transaction Event End.", args.end); |
|
|
263 |
flush(gStr + tStr); |
|
|
264 |
} |
|
|
265 |
}; |
|
|
266 |
/* end transaction event object */ |
|
|
267 |
|
|
|
268 |
/* Output the results to the DIV container */ |
|
|
269 |
function flush(s) { |
|
|
270 |
d.set("innerHTML", s); |
|
|
271 |
|
|
|
272 |
if (state === 'global') { |
|
|
273 |
gStr = ''; |
|
|
274 |
} |
|
|
275 |
else { |
|
|
276 |
gStr = ''; |
|
|
277 |
tStr = ''; |
|
|
278 |
} |
|
|
279 |
}</pre> |
|
|
280 |
|
|
|
281 |
|
|
|
282 |
<h3>Subscribe to the Global events</h3> |
|
|
283 |
<p>With the handler object <code>gH</code defined, we can now subscribe to the Global events.</p> |
|
|
284 |
|
|
|
285 |
<pre class="code prettyprint">// Notice the object context of "gH" is provided as the |
|
|
286 |
// third argument of <code>Y.on()</code>, to preserve the proper |
|
|
287 |
// context of 'this' as used in <code>gH's</code> methods. |
|
|
288 |
|
|
|
289 |
/* Subscribe to the global events */ |
|
|
290 |
Y.on('io:start', gH.start, gH, 'global foo'); |
|
|
291 |
Y.on('io:complete', gH.complete, gH, 'global bar'); |
|
|
292 |
Y.on('io:success', gH.success, gH, 'global baz'); |
|
|
293 |
Y.on('io:failure', gH.failure, gH); |
|
|
294 |
Y.on('io:end', gH.end, gH, 'global boo'); |
|
|
295 |
/* End event subscription */</pre> |
|
|
296 |
|
|
|
297 |
|
|
|
298 |
<h3>Assemble a Configuration Object to set Transaction Event Listeners</h3> |
|
|
299 |
<p>Use a configuration object to define which Transaction Events you wish to handle, for the specific transaction.</p> |
|
|
300 |
|
|
|
301 |
<pre class="code prettyprint">/* Configuration object for setting Transaction Events */ |
|
|
302 |
var cfg = { |
|
|
303 |
on: { |
|
|
304 |
start: tH.start, |
|
|
305 |
complete: tH.complete, |
|
|
306 |
success: tH.success, |
|
|
307 |
failure: tH.failure, |
|
|
308 |
end: tH.end |
|
|
309 |
}, |
|
|
310 |
context: tH, |
|
|
311 |
arguments: { |
|
|
312 |
start: 'foo', |
|
|
313 |
complete: 'bar', |
|
|
314 |
success: 'baz', |
|
|
315 |
failure: 'Oh no!', |
|
|
316 |
end: 'boo' |
|
|
317 |
} |
|
|
318 |
};</pre> |
|
|
319 |
|
|
|
320 |
|
|
|
321 |
<h3>Initiate the Transaction</h3> |
|
|
322 |
<p> |
|
|
323 |
Finally, we set up two buttons -- one for each type of transaction -- and add a "click" listener to each of them. The handler -- function <code>call()</code> -- make an |
|
|
324 |
IO request, based on which button was clicked. |
|
|
325 |
</p> |
|
|
326 |
|
|
|
327 |
<pre class="code prettyprint">function call(e, b) { |
|
|
328 |
if (b) { |
|
|
329 |
state = 'all'; |
|
|
330 |
} |
|
|
331 |
else { |
|
|
332 |
state = 'global'; |
|
|
333 |
} |
|
|
334 |
|
|
|
335 |
Y.io('../assets/io/get.txt', cfg); |
|
|
336 |
} |
|
|
337 |
|
|
|
338 |
Y.on('click', call, "#get1", this, false); |
|
|
339 |
Y.on('click', call, "#get2", this, true);</pre> |
|
|
340 |
|
|
|
341 |
|
|
|
342 |
<h4>Full Code</h4> |
|
|
343 |
|
|
|
344 |
<p>The full JavaScript code for this example follows:</p> |
|
|
345 |
|
|
|
346 |
<pre class="code prettyprint"><div id="container"> |
|
|
347 |
<ul> |
|
|
348 |
<li>IO GET response data will appear here.</li> |
|
|
349 |
</ul> |
|
|
350 |
</div> |
|
|
351 |
<form> |
|
|
352 |
<input id="get1" type="button" value="GET with Global Listeners. " /> |
|
|
353 |
<input id="get2" type="button" value="GET with Global and Transaction Listeners" /> |
|
|
354 |
</form> |
|
|
355 |
|
|
|
356 |
<script> |
|
|
357 |
YUI().use("io-base", "node", |
|
|
358 |
|
|
|
359 |
function(Y) { |
|
|
360 |
|
|
|
361 |
//Get a reference to the DIV that we are using |
|
|
362 |
//to report results. |
|
|
363 |
var d = Y.one('#container'), |
|
|
364 |
gStr = '', |
|
|
365 |
tStr = '', |
|
|
366 |
state; |
|
|
367 |
|
|
|
368 |
/* global listener object */ |
|
|
369 |
var gH = { |
|
|
370 |
write: function(s, args) { |
|
|
371 |
gStr += "ID: " + s; |
|
|
372 |
if (args) { |
|
|
373 |
gStr += " " + "The globally-defined arguments are: " + args; |
|
|
374 |
} |
|
|
375 |
gStr += "<br>"; |
|
|
376 |
}, |
|
|
377 |
start: function(id) { |
|
|
378 |
// When transaction listeners are handled, its user-defined arguments |
|
|
379 |
// are accessible in the arguments collection. The following detection |
|
|
380 |
// logic determines whether the output should account for transaction |
|
|
381 |
// arguments. |
|
|
382 |
args = state === 'global' ? arguments[1] : arguments[2]; |
|
|
383 |
this.write(id + ": Global Event Start.", args); |
|
|
384 |
}, |
|
|
385 |
complete: function(id, o) { |
|
|
386 |
args = state === 'global' ? arguments[2] : arguments[3]; |
|
|
387 |
this.write(id + ": Global Event Complete. The status code is: " + o.status + ".", args); |
|
|
388 |
}, |
|
|
389 |
success: function(id, o) { |
|
|
390 |
args = state === 'global' ? arguments[2] : arguments[3]; |
|
|
391 |
this.write(id + ": Global Event Success. The response is: " + o.responseText + ".", args); |
|
|
392 |
}, |
|
|
393 |
failure: function(id, o) { |
|
|
394 |
args = state === 'global' ? arguments[2] : arguments[3]; |
|
|
395 |
this.write(o + ": Global Event Failure. The status text is: " + o.statusText + ".", args); |
|
|
396 |
}, |
|
|
397 |
end: function(id) { |
|
|
398 |
args = state === 'global' ? arguments[1] : arguments[2]; |
|
|
399 |
this.write(id + ": Global Event End.", args); |
|
|
400 |
if (state === 'global') { |
|
|
401 |
flush(gStr); |
|
|
402 |
} |
|
|
403 |
} |
|
|
404 |
}; |
|
|
405 |
/* end global listener object */ |
|
|
406 |
|
|
|
407 |
/* transaction event object */ |
|
|
408 |
var tH = { |
|
|
409 |
write: function(s, args) { |
|
|
410 |
tStr += "ID: " + s; |
|
|
411 |
if (args) { |
|
|
412 |
tStr += " " + "The arguments are: " + args; |
|
|
413 |
} |
|
|
414 |
tStr += "<br>"; |
|
|
415 |
}, |
|
|
416 |
start: function(id, args) { |
|
|
417 |
this.write(id + ": Transaction Event Start.", args.start); |
|
|
418 |
}, |
|
|
419 |
complete: function(id, o, args) { |
|
|
420 |
this.write(id + ": Transaction Event Complete. The status code is: " + o.status + ".", args.complete); |
|
|
421 |
}, |
|
|
422 |
success: function(id, o, args) { |
|
|
423 |
this.write(id + ": Transaction Event Success. The response is: " + o.responseText + ".", args.success); |
|
|
424 |
}, |
|
|
425 |
failure: function(id, o, args) { |
|
|
426 |
this.write(id + ": Transaction Event Failure. The status text is: " + o.statusText + ".", args.failure); |
|
|
427 |
}, |
|
|
428 |
end: function(id, args) { |
|
|
429 |
this.write(id + ": Transaction Event End.", args.end); |
|
|
430 |
flush(gStr + tStr); |
|
|
431 |
} |
|
|
432 |
}; |
|
|
433 |
/* end transaction event object */ |
|
|
434 |
|
|
|
435 |
/* Output the results to the DIV container */ |
|
|
436 |
function flush(s) { |
|
|
437 |
d.set("innerHTML", s); |
|
|
438 |
if (state === 'global') { |
|
|
439 |
gStr = ''; |
|
|
440 |
} |
|
|
441 |
else { |
|
|
442 |
gStr = ''; |
|
|
443 |
tStr = ''; |
|
|
444 |
} |
|
|
445 |
} |
|
|
446 |
|
|
|
447 |
/* attach global listeners */ |
|
|
448 |
Y.on('io:start', gH.start, gH, 'global foo'); |
|
|
449 |
Y.on('io:complete', gH.complete, gH, 'global bar'); |
|
|
450 |
Y.on('io:success', gH.success, gH, 'global baz'); |
|
|
451 |
Y.on('io:failure', gH.failure, gH); |
|
|
452 |
Y.on('io:end', gH.end, gH, 'global boo'); |
|
|
453 |
/* end global listener binding */ |
|
|
454 |
|
|
|
455 |
/* configuration object for transactions */ |
|
|
456 |
var cfg = { |
|
|
457 |
on: { |
|
|
458 |
start: tH.start, |
|
|
459 |
complete: tH.complete, |
|
|
460 |
success: tH.success, |
|
|
461 |
failure: tH.failure, |
|
|
462 |
end: tH.end |
|
|
463 |
}, |
|
|
464 |
context: tH, |
|
|
465 |
headers: { 'X-Transaction': 'GET Example'}, |
|
|
466 |
arguments: { |
|
|
467 |
start: 'foo', |
|
|
468 |
complete: 'bar', |
|
|
469 |
success: 'baz', |
|
|
470 |
failure: 'Oh no!', |
|
|
471 |
end: 'boo' |
|
|
472 |
} |
|
|
473 |
}; |
|
|
474 |
/* end configuration object */ |
|
|
475 |
|
|
|
476 |
function call(e, b) { |
|
|
477 |
if (b) { |
|
|
478 |
state = 'all'; |
|
|
479 |
} |
|
|
480 |
else { |
|
|
481 |
state = 'global'; |
|
|
482 |
} |
|
|
483 |
|
|
|
484 |
Y.io('../assets/io/get.txt', cfg); |
|
|
485 |
} |
|
|
486 |
|
|
|
487 |
Y.on('click', call, "#get1", Y, false); |
|
|
488 |
Y.on('click', call, "#get2", Y, true); |
|
|
489 |
}); |
|
|
490 |
</script></pre> |
|
|
491 |
|
|
|
492 |
</div> |
|
|
493 |
</div> |
|
|
494 |
</div> |
|
|
495 |
|
|
|
496 |
<div class="yui3-u-1-4"> |
|
|
497 |
<div class="sidebar"> |
|
|
498 |
|
|
|
499 |
|
|
|
500 |
|
|
|
501 |
<div class="sidebox"> |
|
|
502 |
<div class="hd"> |
|
|
503 |
<h2 class="no-toc">Examples</h2> |
|
|
504 |
</div> |
|
|
505 |
|
|
|
506 |
<div class="bd"> |
|
|
507 |
<ul class="examples"> |
|
|
508 |
|
|
|
509 |
|
|
|
510 |
<li data-description="Use IO to request data over HTTP."> |
|
|
511 |
<a href="get.html">HTTP GET to request data</a> |
|
|
512 |
</li> |
|
|
513 |
|
|
|
514 |
|
|
|
515 |
|
|
|
516 |
<li data-description="Use IO to request XML data from a remote web service."> |
|
|
517 |
<a href="weather.html">Request XML data from Yahoo! Weather</a> |
|
|
518 |
</li> |
|
|
519 |
|
|
|
520 |
|
|
|
521 |
|
|
|
522 |
<li data-description="Use IO to make a cross-domain request to Yahoo! Pipes, returning data from disparate sources."> |
|
|
523 |
<a href="xdr.html">Request JSON using Yahoo! Pipes</a> |
|
|
524 |
</li> |
|
|
525 |
|
|
|
526 |
|
|
|
527 |
|
|
|
528 |
|
|
|
529 |
</ul> |
|
|
530 |
</div> |
|
|
531 |
</div> |
|
|
532 |
|
|
|
533 |
|
|
|
534 |
|
|
|
535 |
<div class="sidebox"> |
|
|
536 |
<div class="hd"> |
|
|
537 |
<h2 class="no-toc">Examples That Use This Component</h2> |
|
|
538 |
</div> |
|
|
539 |
|
|
|
540 |
<div class="bd"> |
|
|
541 |
<ul class="examples"> |
|
|
542 |
|
|
|
543 |
|
|
|
544 |
|
|
|
545 |
|
|
|
546 |
|
|
|
547 |
|
|
|
548 |
|
|
|
549 |
|
|
|
550 |
<li data-description="Shows how to create a simple plugin to retrieve content for the Overlay using the io utility."> |
|
|
551 |
<a href="../overlay/overlay-io-plugin.html">IO Plugin</a> |
|
|
552 |
</li> |
|
|
553 |
|
|
|
554 |
|
|
|
555 |
</ul> |
|
|
556 |
</div> |
|
|
557 |
</div> |
|
|
558 |
|
|
|
559 |
</div> |
|
|
560 |
</div> |
|
|
561 |
</div> |
|
|
562 |
</div> |
|
|
563 |
|
|
|
564 |
<script src="../assets/vendor/prettify/prettify-min.js"></script> |
|
|
565 |
<script>prettyPrint();</script> |
|
|
566 |
|
|
|
567 |
<script> |
|
|
568 |
YUI.Env.Tests = { |
|
|
569 |
examples: [], |
|
|
570 |
project: '../assets', |
|
|
571 |
assets: '../assets/io', |
|
|
572 |
name: 'get', |
|
|
573 |
title: 'HTTP GET to request data', |
|
|
574 |
newWindow: '', |
|
|
575 |
auto: false |
|
|
576 |
}; |
|
|
577 |
YUI.Env.Tests.examples.push('get'); |
|
|
578 |
YUI.Env.Tests.examples.push('weather'); |
|
|
579 |
YUI.Env.Tests.examples.push('xdr'); |
|
|
580 |
YUI.Env.Tests.examples.push('overlay-io-plugin'); |
|
|
581 |
|
|
|
582 |
</script> |
|
|
583 |
<script src="../assets/yui/test-runner.js"></script> |
|
|
584 |
|
|
|
585 |
|
|
|
586 |
|
|
|
587 |
</body> |
|
|
588 |
</html> |