Results 1 to 6 of 6

Thread: how to set up application to allways send json object as parameters to server?

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2013
    Location
    Slovakia
    Posts
    75
    Answers
    2
    Vote Rating
    21
      0  

    Default how to set up application to allways send json object as parameters to server?

    Hi,
    are there in the modern toolkit some configs that will force all my ajax requests (store.load(), form.submit(), ajax.request() ...) to send with all parameters encoded as one json object (http request body)? And if there are not such configs, which classes and methods should I overwrite to make it work? The reason is that my client application communicates with server json api...
    Thanks.

  2. #2
    Sencha User
    Join Date
    Apr 2013
    Posts
    837
    Answers
    104
    Vote Rating
    169
      0  

    Default

    You can set writeAllFields to true on the proxy writer config to always send all fields.

  3. #3
    Sencha Premium Member
    Join Date
    Oct 2013
    Location
    Slovakia
    Posts
    75
    Answers
    2
    Vote Rating
    21
      0  

    Default

    Thanks for the answer, but that's not the problem. What I need is to configure/overwrite my extjs modern application to send all my data to the server in JSON format. Actually, the only problem for me is how to submit form data in JSON format instead of query string format. All requests to server api use POST method and json object should be send as raw post body. In case of simple ajax request (Ext.Ajax.request) I can use jsonData instead of params parameter. In case of stores and model I can use paramsAsJson config of data proxy. Is there some config that can force to submit form data (form.submit()) in JSON format?

  4. #4
    Sencha User
    Join Date
    Apr 2013
    Posts
    837
    Answers
    104
    Vote Rating
    169
      0  

    Default

    Have you tried jsonSubmit?

  5. #5
    Sencha Premium User alexander.urban's Avatar
    Join Date
    Nov 2013
    Posts
    321
    Answers
    9
    Vote Rating
    49
      0  

    Default

    jsonSubmit is not available in the modern toolkit, nor any equivalent. We are had to modify our backend to accept formdata as well because of this missing feature in the modern toolkit.

  6. #6
    Sencha Premium Member
    Join Date
    Oct 2013
    Location
    Slovakia
    Posts
    75
    Answers
    2
    Vote Rating
    21
      0  

    Default

    Well, I didn't know about Ext.form.Panel.jsonSubmit config from classic toolkit, thanks for the tip. So the question now is: is there some alternative to this config in modern toolkit (6.5.2)?

Similar Threads

  1. Server proxy: send parameters as JSON
    By alexander.urban in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 22 Feb 2017, 7:28 AM
  2. Replies: 2
    Last Post: 17 Apr 2012, 1:21 AM
  3. How to send parameters to ASP.NET JSON WebService
    By jchau in forum Ext 2.x: Help & Discussion
    Replies: 23
    Last Post: 24 Mar 2011, 12:49 AM
  4. How to send JSON object instead of 'regular' POST parameters
    By hflipman in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 6 Jan 2010, 11:36 AM
  5. How to send a normal request to the server with parameters from Ext?
    By biot023 in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 26 Jul 2007, 12:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •