How to send form data in JSON format

380 views Asked by At

I use ExtDirect to communicate server. I need to send form data in json to remote functions. It seems that it ignore jsonSubmit config and send data as form post. How should I config my API on the server and client that all file-free request be send in json format.

1

There are 1 answers

0
websky On

In the case of Zend... Register provider class in Ext.Direct manager:

Ext.require(
    [
        'Ext.direct.*',
        'MyApp.lib.direct.ZendFrameworkProvider'
    ], function () {
        Ext.direct.Manager.addProvider(
            {
                'type': 'zf',
                'url': Ext.app.JSONRPC_API.target,
                'actions': Ext.app.JSONRPC_API.services,
                'format': 'json'
            });
    });

read more:

Ext.Direct and JSON server based on Zend

and Ext.Direct File Upload - Form submit of type application/json