views:

42

answers:

1

I am having an issue where dojo seems to be caching html and then not properly redisplaying it. If I call this function once it works fine, and it works on all subsequent calls if the parameters are unique. If I call it twice with duplicate parameters then essentially nothing happens. I'd appreciate any help.

 function findName(name, page){  
             var id = dojo.byId("userId");
             dojo.byId("result").innerHTML = "<b>Loading...</b>";
             dojo.xhrGet({
                url: "/test.html?pName="+name+"id="+id.value+"&page="+ page,
                load: function(data, ioargs){
                   dojo.byId("result").innerHTML = data;
                },
                error: function(error,ioargs){
                   alert(error);
                }
             }); 
          }
A: 

It doesn't look like Dojo is caching the html, but rather your browser or your web server are perhaps caching the result.

Try adding preventCache: true to your property object for dojo.xhrGet:

dojo.xhrGet({
   url: "/test.html?pName="+name+"id="+id.value+"&page="+ page,
   preventCache: true,        
   load: function(data, ioargs){
      dojo.byId("result").innerHTML = data;
   },
   error: function(error,ioargs){
      alert(error);
   }
});
Kyle Hayes