jQuery rpc 介绍
The is rpc(remote procedure call) client implementation based on JQuery. It
creates an rpc object and adds ability to call them. It supports both xml and
json rpc. The datatype support listing is coming soon. It is in early stage.
It will not be upgraded if you do not provide feedback . Please take a look at
the code and let me know what you think :) .
Synopsis
$.rpc(url, dataType, onLoadCallback, version)
parameters:
url - The url of the rpc server.
dataType - It can be json or xml depending on the rpc server
(optional, default:json).
onLoadCallback - It is the method called when the rpc object is loaded
from server response (optional).
version - The rpc server version (optional).
returns: - The rpc object parsed from the rpc server.
How to use:
After calling the $.rpc(your_server) you can get all the objects and
methods in that server.
var server = $.rpc(your_server_url, "xml");
It may take some time to load the server data. You can assign a load
callback to add task when
the server is loaded. Finally you can call the server functions like this,
// call system.getCapabilities like this server.system.getCapabilities(function(data){console.log(data)}); // or server.yourObject.com.your.object.yourMethod(yourParams, callback);
Note that this procedure is asynchronous. And callback functions are
called when a task is done ..
And here is the demo code,
`
`
The above code will connect to the provided rpc server and list the
methods in system object ..
Please let me know if the above document is helpful. And let me know
if you have any suggestion.
jQuery rpc 官网
http://plugins.jquery.com/project/rpc
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。