Aidan Garnish

Collaboration Not Competition

XmlHttpRequest Cache Busters

The call to a generic handler in the post Using generic handlers in Dynamics CRM seemed to only be firing once. The alert was being displayed to say that the code had run successfully but I could see that after the first call it wasn't copying the entity as it should have.

It turns out this was because the xmlhttprequest was being cached and the fix was fairly simple. By adding an extra parameter to the url called by the request we can trick it into thinking that a completely new call is being made which prevents the cached result from being used.

Simply add the following to the query string: "bustCache=" + Math.random();

Add comment