| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> | |
| <html> | |
| <head> | |
| <title>Dojo Element / Jayrocks Service Demonstration</title> | |
| <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> | |
| <meta name=ProgId content=VisualStudio.HTML> | |
| <meta name=Originator content="Microsoft Visual Studio .NET 7.1"> | |
| <script language="javascript" src="DemoService.ashx?proxy&v=2"></script> | |
| <script language="javascript" src="js/dojo/dojo.js"></script> | |
| <script language="javascript"> | |
| dojo.require("dojo.io.*"); | |
| dojo.require("dojo.event.*"); | |
| dojo.require("dojo.html.*"); | |
| dojo.require("dojo.json"); | |
| // Invokes service method | |
| function dojoChannel(call) | |
| { | |
| var bindArgs = { | |
| url: call.url+'?rpc', | |
| error: function(type, data, evt){alert("error");}, | |
| method: "POST", | |
| mimetype: "text/json", | |
| handle: call.callback, | |
| postContent: dojo.json.serialize(call.request) | |
| }; | |
| var req = dojo.io.bind(bindArgs); | |
| dojo.event | |
| return req; | |
| } | |
| // Formats output into a control | |
| function string_array_element(type, data, evt) | |
| { | |
| var arr = data.result; | |
| var theDiv = dojo.byId('string_array'); | |
| var select = document.createElement('select'); | |
| for(var i=0; i < arr.length; i++) | |
| { | |
| select.options[i] = new Option(arr[i], arr[i]); | |
| } | |
| theDiv.appendChild(select); | |
| } | |
| // Wraps call to RPC method | |
| function getStringArray() | |
| { | |
| DemoService.rpc.getStringArray(string_array_element).call(dojoChannel); | |
| } | |
| // Obtains output on page load | |
| dojo.event.connect(window, "onload", getStringArray); | |
| </script> | |
| </head> | |
| <body> | |
| <h2>getStringArray as Select control</h2> | |
| <div id="string_array"></div> | |
| <hr /> | |
| </body> | |
| </html> |