0

I'm trying to cache results from several pages that do heavy database processing. These pages feeds a jqGrid (it's a really nice grid component) through a JSON response. After reading several S.O. posts about jqGrid it came to my attention that jqGrid always send a random number (nd) even if you don't send anything to your server. This is to prevent an automatic cache from IE browsers (8 or less).

But since i want to cache my results on client side, i removed this nd number through prmNames: {nd: null}. It worked fine if get my results from server with a POST request, but when i try to change the verb request to GET, the nd number appears with a different name, a single underscore _.

Below theres a firebug print i took to make things clearer.

enter image description here

So, is this a bug or can i remove it from my requests in order to cache properly the server results?

AdrianoRR
  • 1,131
  • 1
  • 17
  • 36

1 Answers1

0

The _ will be not sent by jqGrid by default. I suppose that you include cache: false of jQuery.ajax. Probably you used ajaxGridOptions: {cache: false} option.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Man, that was directly to the point! However i still can't get my page cached on client :( But since this solves my problem, i'll take it as an answer. And good work on getting nd to be null, Oleg. I read the original post that made jqGrid's creator Tony to able nd be changed to null. – AdrianoRR Apr 02 '12 at 13:40
  • @AdrianoRR: If you write that the page cached on client you have to set "Cache-Control" header which describes the rules tor caching. See [the answer](http://stackoverflow.com/a/3722532/315935) and [here](http://stackoverflow.com/a/3885956/315935) for example. You can read more [in the tutorial](http://www.mnot.net/cache_docs/) about caching options of HTTP protocol. – Oleg Apr 02 '12 at 13:53