Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Definitely. We would need a bit more information to know what kind of service you are using and if you are using a JS library. This is very easy with Dojo or EXT. I'll show you a Dojo example as that is what I'm working with the most lately. I mostly create my services as REST services at this point. Depending on the service and how it's going to be used, I either send the response back as JSON or JSONP. Below is an example for services that send the response as JSONP, which I use for cross-domain calls. You would need to use dojo.io.script.get (if using the Dojo library):</p> <pre><code>dojo.io.script.get({ callbackParamName: 'method', url: 'http://mydomain/myservicename/mymethodname/param1/param2', timeout: 20000, load: dojo.hitch(this,function(response,ioArgs) { this.doSomething(response); }), error: dojo.hitch(this,function(error) { alert('uh oh, something went wrong'); }) }); </code></pre> <p>For services that send the response back as JSON, you can use the following Dojo functions: dojo.xhr, dojo.xhrDelete, dojo.xhrGet, dojo.xhrPost, dojo.xhrPut, dojo.rawXhrPost, and dojo.rawXhrPut depending on the type of call you make. Below is an example:</p> <pre><code>dojo.rawXhrPost({ url: url, handleAs: 'json', postData: parametersJSON, headers: { "Content-Type": "text/json" }, timeout: 45000, //function to be run in case of successful call to the specified Web method load: function(data) { onComplete(data); }, //function to be run in case of failed call to the specified Web method error: function(error) { onError(error.message); } }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload