Search code examples
extjs4datastore

Random numbers added to extjs data store ajax call


 var resource_store = Ext.create('Ext.data.Store', {
 pageSize: 10,
autoLoad: true,
fields: ['id','r_number','c_number','resource_name','resource_desc','resource_url','resource_file'],
proxy: {
    type: 'ajax',
    url: BASE_URL+'courses/resources/displayResources/'+course_id,
    reader: {
        type: 'json',
        root: 'results'
   }
},
storeId: 'id'
});

I'm using Extjs4 data store like this way. When i see the ajax calls a random number is appended to the url

http://localhost/Edu_web/index.php/courses/resources/displayResources/PTGRE14?_dc=1328442262503&page=1&start=0&limit=10

Even though i use actionMethod:{ read: 'POST' }.

?_dc=1328442262503 still appears in the url.

how to remove these parameters in url. and send any parameters through POST


Solution

  • Even though i use actionMethod:{ read: 'POST' }.

    ?_dc=1328442262503 still appears in the url.

    Of course it would. You should use actionMethods (with 's' at the end).

    To remove _dc from GET request you should add noCache: false to proxy's config. Docs for noCache.

    P.S. Using a POST for reading is a bad practise. You should only use a POST when you are modifying data on the server.