source: lliurex-mirror/trunk/fuentes/lliurex-mirror-core.install/usr/share/lliurex-mirror/lliurex-mirror/xmlrpc/jquery-xmlrpc-master/README.md @ 246

Last change on this file since 246 was 246, checked in by hectorgh, 5 years ago

adding project files

File size: 2.4 KB
Line 
1jQuery XML-RPC library
2======================
3
4This is a small library that sits on top of jQuery for communicating with
5XML-RPC services - without worrying about the horrible bloat of XML-RPC. Using
6this library, you can pass JSON parameters to the library, and receive
7responses in JSON. Encoding the JSON document is handled for you, intelligently
8mapping types between the two languages.
9
10Installing
11----------
12
13Simply include the jQuery library, and this library in your page:
14
15```html
16<script src="jquery-1.8.1.js"></script>
17<script src="jquery.xmlrpc.js"></script>
18```
19
20This was built upon jQuery 1.8.1. It will probably work with old versions, and
21will probably continue to work with new versions.
22
23Using
24-----
25
26The `jQuery.xmlrpc` function is the main work-horse of this library. Call it
27like so:
28
29```javascript
30$.xmlrpc({
31        url: '/RPC2',
32        methodName: 'foo',
33        params: ['bar', 1, 4.6, true, [1, 2, 3], {name: 'value'}],
34        success: function(response, status, jqXHR) { /* ... */ },
35        error: function(jqXHR, status, error) { /* ... */ }
36});
37```
38
39It takes all of the same arguments as `jQuery.ajax`, so refer there for more
40documentation. The two new keys added are:
41
42### `methodName`
43
44This is method put in the `<methodName>` element from XML-RPC. It should be a
45string. The XML-RPC service you are communicating with will determine valid
46method names you can call.
47
48### `params`
49
50An array of parameters to send. Specify an empty array, or do not supply this
51key at all if you do not want to send any parameters.
52
53See the docs section on [Encoding and Decoding XML-RPC Documents][encoding] for
54more information.
55
56### Getting data back
57
58When the XML-RPC call returns, the contents of the `<params>` element are
59parsed into JSON and supplied to the `success` callback of the AJAX call as the
60first parameter, much like a JSON request.
61
62### Handling errors
63
64If any HTTP errors occur during transport, the normal jQuery AJAX error
65handling will be used. If the XML-RPC service successfully replies, but replies
66with a `<fault>` response, an `$.xmlrpc.XmlRpcFault` is thrown. This error will
67be sent as the third parameter to the `error` callback of the AJAX call, as
68with other errors.
69
70Documentation
71-------------
72
73[The full documentation can be found on Read The Docs][docs].
74
75[docs]: http://jquery-xml-rpc.readthedocs.org/ "Documentation"
76[encoding]: http://jquery-xml-rpc.readthedocs.org/en/latest/types.html#encoding-and-decoding-xml-rpc-documents
77        "Encoding and Decoding XML-RPC Documents"
Note: See TracBrowser for help on using the repository browser.