upgrade to yui 2.5.1
This commit is contained in:
parent
e00050ad1c
commit
ff7d72becc
1632 changed files with 812103 additions and 0 deletions
16
www/extras/yui/examples/json/assets/jsonConnect.php
Normal file
16
www/extras/yui/examples/json/assets/jsonConnect.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
/* yadl_spaceid - Skip Stamping */
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$messages =<<<END
|
||||
[
|
||||
{ "animal" : "Cat", "message" : "Meow" },
|
||||
{ "animal" : "Dog", "message" : "Woof" },
|
||||
{ "animal" : "Cow", "message" : "Moo" },
|
||||
{ "animal" : "Duck", "message" : "Quack" },
|
||||
{ "animal" : "Lion", "message" : "Roar" }
|
||||
]
|
||||
END;
|
||||
|
||||
echo($messages);
|
||||
?>
|
||||
86
www/extras/yui/examples/json/index.html
Normal file
86
www/extras/yui/examples/json/index.html
Normal file
File diff suppressed because one or more lines are too long
258
www/extras/yui/examples/json/json_connect.html
Normal file
258
www/extras/yui/examples/json/json_connect.html
Normal file
File diff suppressed because one or more lines are too long
101
www/extras/yui/examples/json/json_connect_clean.html
Normal file
101
www/extras/yui/examples/json/json_connect_clean.html
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>JSON with Connection Manager</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*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>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/json/json-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>JSON with Connection Manager</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>A natural fit for the JSON Utility is working with the <a href="http://developer.yahoo.com/yui/connection/">Connection Manager</a>. In this example, we'll request JSON data from the server using Connection Manager's <code>asyncRequest</code> and parse the resulting JSON string data for processing.</p>
|
||||
<p>Click the Get Messages button to send the request to the server.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="demo">
|
||||
<input type="button" id="demo_btn" value="Get Messages">
|
||||
|
||||
<div id="demo_msg"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.on('demo_btn','click',function (e) {
|
||||
// Get the div element in which to report messages from the server
|
||||
var msg_section = YAHOO.util.Dom.get('demo_msg');
|
||||
msg_section.innerHTML = '';
|
||||
|
||||
// Define the callbacks for the asyncRequest
|
||||
var callbacks = {
|
||||
|
||||
success : function (o) {
|
||||
YAHOO.log("RAW JSON DATA: " + o.responseText);
|
||||
|
||||
// Process the JSON data returned from the server
|
||||
var messages = [];
|
||||
try {
|
||||
messages = YAHOO.lang.JSON.parse(o.responseText);
|
||||
}
|
||||
catch (x) {
|
||||
alert("JSON Parse failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
YAHOO.log("PARSED DATA: " + YAHOO.lang.dump(messages));
|
||||
|
||||
// The returned data was parsed into an array of objects.
|
||||
// Add a P element for each received message
|
||||
for (var i = 0, len = messages.length; i < len; ++i) {
|
||||
var m = messages[i];
|
||||
var p = document.createElement('p');
|
||||
var message_text = document.createTextNode(
|
||||
m.animal + ' says "' + m.message + '"');
|
||||
p.appendChild(message_text);
|
||||
msg_section.appendChild(p);
|
||||
}
|
||||
},
|
||||
|
||||
failure : function (o) {
|
||||
if (!YAHOO.util.Connect.isCallInProgress(o)) {
|
||||
alert("Async call failed!");
|
||||
}
|
||||
},
|
||||
|
||||
timeout : 3000
|
||||
}
|
||||
|
||||
// Make the call to the server for JSON data
|
||||
YAHOO.util.Connect.asyncRequest('GET',"assets/jsonConnect.php", callbacks);
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue