How can I pass Json Rpc data to a specified callback function, just like Json.
You can get the response data by specifying the callback parameter in the url.
For example:
var url = "http://...sample/..?alt=new&callback=dispUser";
var script = document.createElement('script');
script.src = url;
document.body.appendChild(script);
then the result would be something like this
dispUser({
“id”: “”
});
but in Json Rpc I can’t, is there a way to get the response data of Json Rpc by declaring a callback. If none how would I display these data in a client side. Because I can only get these api services using Json Rpc or SOAP XML, that’s what the documentation tells.
Your example is in JSONP style. Here’s an example in JSON-RPC style:
If the JSON-RPC service doesn’t describe itself via SMD, you might write something like this instead:
There are quite a few libraries for doing JSON-RPC from a JavaScript client (e.g: the browser), and each may be slightly different in calling convention.