添加到 extjs 数据存储 ajax 调用的随机数

发布于 2025-01-02 14:22:47 字数 729 浏览 3 评论 0原文

 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 use
actionMethod:{
read: 'POST'
}
.

?_dc=1328442262503 still appears in the url.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

涙—继续流 2025-01-09 14:22:47

即使我使用 actionMethod:{ read: 'POST' }.

?_dc=1328442262503 仍然出现在网址中。

当然会。您应该使用 actionMethods (末尾带有“s”)。

要从 GET 请求中删除 _dc,您应该将 noCache: false 添加到代理的配置中。 noCache 文档< /a>.

PS 使用 POST 进行阅读是一种不好的做法。仅当修改服务器上的数据时才应使用 POST。

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.

无所的.畏惧 2025-01-09 14:22:47

如果您的网络中有任何代理,在禁用随机数之前,请检查它们是否禁用了缓存,否则客户端不会从服务器下载更新的页面,而是继续读取代理中存储的先前页面。添加到调用中的随机数使其每次都不同,并且代理将被迫始终从服务器下载它

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文