Hi Firends
I am working with $.ajax and facing an cache issue, however I have mark the
cache:false
in my
$.ajax
request.
The server side code is working fine it returns the results as it should be. I tried to debug the code and found though the result is coming fine but
data.d
in ajax success method is returning / displaying the first executed result.
For example: In my 1st search for and server returns me 1 record, in 2nd search it return 70 records. I am successfully able to show the records in the
jqGrid
, but internally when I loop the records to search on
item
variable in my code below it contains only 1 record instead of 70.
Below is my code:
$.ajaxSetup({
cache: false
});
$("#tblSearch").jqGrid("clearGridData", true).trigger("reloadGrid");
var abc = Math.random();
$.ajax({
url: "abc.aspx/somemethod",
data: JSON.stringify({ isActive: SIsActive, clientName: sName}),
contentType: "application/json; charset=utf-8",
dataType: "json",
type: "POST",
cache: false,
success: function (Data) {
var item = undefined;
item = $.parseJSON(Data.d);
var items = undefined;
for (var i = 0; i < item.length; i++) {
var asu = item[i];
if (ClientID == asu.ClientID) {
break;
}
}
item.length
is not equals to 70.
After goggling this issue I found the browser IE, by default preserve the cache on the same request. So I tried to change the request by passing a random value to the url.
var abc = Math.random();
But it didn't work for me.
Any guess or success from your side please guide me.
Thanks