添加到 extjs 数据存储 ajax 调用的随机数
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'
});
我正在像这样使用 Extjs4 数据存储。 当我看到 ajax 调用时,一个随机数会附加到 url 中,
http://localhost/Edu_web/index.php/courses/resources/displayResources/PTGRE14?_dc=1328442262503&page=1&start=0&limit=10
即使我使用 操作方法:{ 读:“发布” }
。
?_dc=1328442262503 仍然出现在网址中。
如何删除url中的这些参数。并通过 POST 发送任何参数
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 useactionMethod:{
.
read: 'POST'
}
?_dc=1328442262503 still appears in the url.
how to remove these parameters in url. and send any parameters through POST
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当然会。您应该使用
actionMethods
(末尾带有“s”)。要从 GET 请求中删除 _dc,您应该将
noCache: false
添加到代理的配置中。 noCache 文档< /a>.PS 使用 POST 进行阅读是一种不好的做法。仅当修改服务器上的数据时才应使用 POST。
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.
如果您的网络中有任何代理,在禁用随机数之前,请检查它们是否禁用了缓存,否则客户端不会从服务器下载更新的页面,而是继续读取代理中存储的先前页面。添加到调用中的随机数使其每次都不同,并且代理将被迫始终从服务器下载它
If there are any proxy in your network, before disabling the random number, check to see if they have caching disabled, otherwise the client, instead of downloading the updated pages from the server, will continue to read the previous ones stored in the proxy. The random number added to the call makes it different each time and the proxy will be forced to always download it from the server