开发者

Jquery ajax call result cache problem

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜