IE problem with ajax

Hello,

I have noticed some strange behavior with IE browser. Datatable is configured with onItemClick which will make ajax call and with returned JSON it will generate new datatable bellow which will have html link to call function “SomeName(Variable1)”. THe idea is that user clicks at that link and new popup window will appear with new editable datatable based on Variable1 where user can edit some fields. While user edits fields a function will be called that will update database with ajax.

I made all of that and that works in all browsers. The problem is (only with IE) that, when I close popup window and if I want to open it again using same “SomeName(Variable1)” function. It should make ajax call again and create window again and populate datatable with new data, but it does not. For IE, it shows same data before update. When I check database, I see updated data. It looks like, user can edit it, but can not see changes until IE is closed and opened again. I have no idea why that happens.

I think that popup window is not destroyed when it is closed by default close button, and that new ajax call is not loaded into window. It returns the same data from first load without any error in console.

Hello again,

I have found the solution. IE is caching GET from ajax in order to make user exeprience faster. Unfortunately, I need to change my data all the time so this caching thing is preventing it.

Just typed $.ajaxSetup({ cache: false }); at the begining and case closed :slight_smile:

I have exactly the same problem. I put “no-cache” in the http header on the server-side (i did it years ago for the same problem) but this time it doesn’t work. I don’t use query but webix.ajax. Is there a way to do cache:false in webix ?

You can use POST requests, they are never cached

webix.ajax().post(url, {}, callback);

or use

webix.ajax().get(url, { uid:webix.uid() }, callback);

It will add the unique element to the each request, that will prevent caching as well.

I was dealing with this issue for a while and found that changing params=null for a params={} at the beggining of the webix.ajax.prototype._send was my best shot. So, I just had to attach an onBeforeAjax event and add the cache buster.

:

_send: function(url, params, call, master, mode){
if (params && (webix.isArray(params) || (typeof (params.success || params.error || params) == “function”))){
master = call;
call = params;
params = {}; // ← This is my work-around
}

:

webix.attachEvent(“onBeforeAjax”, function(mode, url, data, request, headers) {
if(mode == ‘GET’ && (!data || (typeof data == ‘object’ && !data[""])))
data.
= webix.uid();
});

Regards

Downloaded webix 3.2 and noticed that webix.ajax.prototype._send changed a bit (blob support) and my work-around stop working. I had to take the new code and replace the params=null by params={} once again.

Is there a technical reason to keep that null assignment? onBeforeAjax seems to be a very handy way to play around with webix.ajax parameters. Even in those cases like .load(url, [type, callback] ) where there is no simple way to attach parameters (besides using a promize url which needs more coding).