开发者

Jquery ajax call result cache problem

开发者 https://www.devze.com 2023-01-29 17:17 出处:网络
I am making an ajax call as follows setting cache: true. But even then aslo it does not store the ajax call result in the cache and everytime it makes ajax call for same 开发者_如何学编程thing.

I am making an ajax call as follows setting cache: true. But even then aslo it does not store the ajax call result in the cache and everytime it makes ajax call for same 开发者_如何学编程thing.

$.ajax(
                            {
                                url: 'abc.aspx/getInfo',
                                cache: true,
                                type: 'POST',
                                data: '{userID: "' + id+ '"}', // id is a variabe
                                contentType: 'application/json; charset=utf-8',
                                dataType: 'json',
                                beforeSend: function() {
                                    // somthing...  
                                },
                               success: function(response, textStatus) {
                                 // something....
                               }
                             }

Can any one tell me why it is happening. How to solve this?


IIRC cache works with GET requests. For POST requests you need to have your server side script send proper HTTP cache headers.

0

精彩评论

暂无评论...
验证码 换一张
取 消