Search code examples
javascriptextjsweb-applicationssencha-touchextjs5

How to post extjs data from form to server?


I have understood how to GET data from server to application. Now I face with POST task. I have form, and want post fields data to server by clicking on button.

I trying to use this:

{//some controllercode

          xtype: 'button'  
          text: 'save',
          ui: 'confirm',
          scope: this,
          handler: function() {
              Ext.Ajax.request({
                  url:'/api/renter/',
                  method: 'POST',
                  params: {
                      ReplaceAllRefs: true
                  }
              })

              }
          }

what the parameter of Ext.Ajax defines data which will post to server through url? I can use this class for POST task or isn't the best way?


Solution

  • In the end i have used this block of code:

    {
                  text: 'save',
                  ui: 'confirm',
                  handler: function() {
                    	
                    	var dataup3 = this.up().items.items[0]; 
    //get form's fields level
                    	var dataSet3 = dataup.getValues();
                    	
                    	Ext.Ajax.request({
                    		url:'/api/cutarea/',
                    		method: 'POST',
                    		params: dataSet3
                    	})
                    }
    }
    Thanks for answers!