PDA

View Full Version : Ext.Ajax with JSON RPC



leksodav
24 Nov 2013, 11:32 AM
I have JSON RPC server which returns JSON data
Unfortunately i find no way to make Ext.Ajax reques to this server

I can only use it with direct store with provider like this
http://www.sencha.com/forum/showthread.php?69895-Zend_Json_Server&p=336311#post336311

any ideas?

leksodav
25 Nov 2013, 8:55 AM
any ideas? :)

silcreval
26 Nov 2013, 4:32 AM
RPC 1 uses a fairly simple protocol:

eg (from wikipedia)

{"method": "echo", "params": ["Hello JSON-RPC"], "id": 1}

you would have to emulate this using extraParams settings in the AJAX proxy settings in the Ext.data.Store

extraParams: {
method: 'echo',
params: [
'Hello JSON-RPC'
],
id: 1
}

and set the actionMethods as appropriate (POST/GET).

You would then have to unpack the result after the AJAX call.

{"result": "Hello JSON-RPC", "error": null, "id": 1}