Reputation: 249
I want to submit data using Ext.ajax.Request
, but the payload being sent is in json format:
{name: 'john gold', id:1, company:'abcde'}
but, i want to submit the payload in simple format:
name=john+gold&id=1&company=abcde
how can i achieve this ?
my method looks like:
Ext.Ajax.request({
url: url,
method: 'POST',
params: payload,
success: function(response) {
var data = Ext.decode(response.responseText).data;
console.log("search data : *** \n" + data);
this.fireEvent("aftersubmit", params, data);
},
scope: this
});
Upvotes: 1
Views: 871
Reputation: 25001
Use method: 'GET'
if you want the params in the url.
Update
You'll got to convert the payload yourself then... Ext.Ajax#request
accepts a string as its params option, and you "url encode" your data object with Ext.Object.toQueryString
. So something like that:
Ext.Ajax.request({
// ...
method: 'POST',
params: Ext.Object.toQueryString(payload)
});
Upvotes: 4