PDA

View Full Version : Clean ajax request



Sadd
10 Jul 2012, 7:46 AM
Hi, i'm working with a cached method in the server side and i'm getting troubles because the ajax request from Extjs is not clean, it has some data in it like Date, Hour, start, limit, etc, and i need just a clean request. Is any way to controll what data is passed to a server from a ajax proxy? Is any way to stop extjs to pass parameters to server?

Thanks for any help,
- Sadd

Izhaki
10 Jul 2012, 8:43 AM
You'd need to provide at least the code of your model for anyone to be able to help you.

Sadd
10 Jul 2012, 9:29 AM
Ok, i'm working with this code:



var reader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
root: 'root',
messageProperty: 'message'
});
var proxy = new Ext.data.HttpProxy({
reader: reader,
type: 'ajax',
api: {
read: '/Center/GetCombo'
},
headers: {
'Content-Type': 'application/json; charset=UTF-8'
}
});

var store = Ext.create('Ext.data.Store', {
autoload: true,
fields: [
{ name: 'Text', type: 'string' },
{ name: 'Value', type: 'string' },
{ name: 'Selected', type: 'string' }
],
proxy: proxy
});


This is working perfectly the problem is the ajax call make a url get with a lot of parameters, and i need the clean request and i dont know how to do that.

- Sadd

scottmartin
10 Jul 2012, 1:00 PM
Add the following to your proxy:



actionMethods: 'POST'



Scott.

Sadd
10 Jul 2012, 1:19 PM
Thanks for your reply Scott, anyway i solved the problem adding this



limitParam: false,
startParam: false,
pageParam: false,
noCache: false,


It does the trick for me, but i'm not sure if it is the correct way proceed, i'll try with your solution but what i did is correct?

- Sadd

scottmartin
10 Jul 2012, 1:49 PM
Your approach will work as well. I was just taking the params off the url. (if you needed any)

Scott.