weird ie11 caching on setValues()

Jeffery_Werner_
Level 2

weird ie11 caching on setValues()

Hello all,

I have a marketo form where is our user is logged in we are prepolulating the form with their account info. We do an API call and using setValues() push the JSON from the API call in to the form. Work great!

However we have a weird issue on ie11

User 1 logs in goes to the page with a form.

User 1 sees their data correctly in the form

User 1 cancels form and logs out (goes to different page)

User 2 logs in goes to the page with a form.

User 2 sees user 1's info prepopulated in the form

If I open dev tools the issue does not occur

This only happens in ie11 (I tested on win 7)

We are not storing the results of the api and there are totally different page loads

Here is my js

if (formUser == "registered"){

  var userInfo = "/store/ecomm/getUserInfo";

  $.getJSON( userInfo, function(data) {

  console.log( "success" );

  })

  .complete(function(data) {

  form.setValues(JSON.parse(data.responseText));

  });

  }

I am thinking of adding a delay on the setValues but would rather not delay the info populating on unaffected browsers. Any ideas? Is something being tracked in the munchkin cookie that im missing in dev tools?

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: weird ie11 caching on setValues()

Don't add any delays. That's just dodging the real cause.

Based on your description, sounds like the JSON response itself is cached.  Try adding a "cachebuster" to your query string.

     var userInfo = "/store/ecomm/getUsetInfo?nc=" + new Date().getTime()

Jeffery_Werner_
Level 2

Re: weird ie11 caching on setValues()

I have put a break point on the response and even on the setValues the JSON object always shows as the correct data User always shows user 1 and user 2 always shows User 2.

Does anything in the marketo library cache the results of the setValues that might be firing and getting in to the form before my api pushes the info in?

SanfordWhiteman
Level 10 - Community Moderator

Re: weird ie11 caching on setValues()

Why didn't you do what I suggested?

And caching across visits -- no. You can't cache variables in JS after the page unloads (without deliberately persisting them to localStorage/sessionStorage/cookies/indexedDB/etc.).