You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.6 KiB
80 lines
2.6 KiB
2 years ago
|
<html>
|
||
|
<head>
|
||
|
<title>Dojo Testing Script</title>
|
||
|
<script type="text/javascript">
|
||
|
var djConfig = {
|
||
|
isDebug: true,
|
||
|
yahooServiceSmdUrl: "../../src/rpc/yahoo.smd", //for xdomain
|
||
|
debugContainerId: "dojoDebug"};
|
||
|
//djConfig.debugAtAllCosts = true;
|
||
|
</script>
|
||
|
<script type="text/javascript" src="../../dojo.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
dojo.require("dojo.rpc.YahooService");
|
||
|
</script>
|
||
|
<script type="text/javascript">
|
||
|
function contentCallback(result) {
|
||
|
dojo.debug(dojo.json.serialize(result));
|
||
|
dojo.byId("ReturnedContent").innerHTML = "<p>" + dojo.json.serialize(result) + "</p>" ;
|
||
|
}
|
||
|
|
||
|
function mapCallback(result){
|
||
|
dojo.byId("ReturnedContent").innerHTML = "<img src="+result.Result+">";
|
||
|
}
|
||
|
|
||
|
dojo.addOnLoad(function(){
|
||
|
svc = new dojo.rpc.YahooService();
|
||
|
});
|
||
|
</script>
|
||
|
</head>
|
||
|
|
||
|
|
||
|
<body>
|
||
|
<div id="example">
|
||
|
<h2> How to initialize the Dojo Yahoo RPC Service: </h2>
|
||
|
<pre>// You need the package of course
|
||
|
dojo.require("dojo.rpc.YahooService");
|
||
|
|
||
|
// Create a callback function to handle the results generated by a method
|
||
|
// A second optional parameter to your call back will allow the callback to use
|
||
|
// the submission Id of the json-rpc request
|
||
|
|
||
|
function contentCallBack(result){
|
||
|
dojo.byId("content").innerHTML = dojo.json.serialize(result);
|
||
|
}
|
||
|
|
||
|
// Create a new object
|
||
|
var testClass = new dojo.rpc.YahooService();
|
||
|
</pre>
|
||
|
</div>
|
||
|
|
||
|
<div id="actions">
|
||
|
<h2>Push these buttons to execute code in the button.</h2>
|
||
|
<h3>Results will be returned below under "Returned Content"</h3>
|
||
|
|
||
|
<!-- Yahoo's geocoding engine is borken
|
||
|
<h4>geocode something!</h4>
|
||
|
<button id="myecho" dojo:type="button" label='testClass.geocode({"street": "1000 Elwell Court", "city": "Palo Alto", "zip": "94303", location: ""}).addCallback(contentCallBack);' onClick='testClass.geocode({"street": "1000 Elwell Court", "city": "Palo Alto", "zip": "94303", location: ""}).addBoth(contentCallBack, contentCallBack);'></button><br>
|
||
|
-->
|
||
|
<button onclick="svc.webSearch({'query':'foo'}).addCallback(contentCallback);">search the web for "foo"</button>
|
||
|
<br>
|
||
|
<button onclick="svc.trafficData({'zip': '94303'}).addCallback(contentCallback);">get traffic congestion data for Palo Alto</button>
|
||
|
<br>
|
||
|
<button onclick="svc.mapImage({'street': '1000 Elwell Court', 'city': 'Palo Alto', 'zip': '94303', 'image_type': 'png', 'image_width': '300', 'image_height': '300', 'zoom': '8'}).addCallback(mapCallback);">display a map to the Dojo offices</button>
|
||
|
<br>
|
||
|
</div>
|
||
|
<br>
|
||
|
|
||
|
<br>
|
||
|
<h2>Returned Content:</h2>
|
||
|
<div id="ReturnedContent">
|
||
|
None.
|
||
|
</div>
|
||
|
|
||
|
<div id="dojoDebug">
|
||
|
<h2>Debug Log:</h2>
|
||
|
</div>
|
||
|
|
||
|
</head>
|
||
|
</html>
|