Yesterday i had an issue that I at first did not understand.

 

Problem:

I had a form that posted data to an Eloqua form using an AJAX call. It all worked great untill we had to try it on mobile devices (WP8 worked but not Android and iPhone/iPad).

It turns out that some devices have an unrealistic approach to how much you need to cache on mobile browsers. So, unstead of posting to the url, the browser returns the cached result and did not post my data to get an updated result. The outcome was that no data was submitted to the Eloqua form and none of the processing steps was executed.

 

Solution:

You need to make sure that the page you are posting to have a different url for each call. In JavaScript, i did this by adding a datetime stamp to the url as a parameter. I also added a no cache statement to the http header of the call. See example below:

 

Before fix:

    $.ajax({
   url: 'https://secure.eloqua.com/e/f2',
   cache: false,
   type: 'POST',
   dataType: 'jsonp',
   data: data,
   success: generalsuccess(),
   error: function (data) {
   if (data['status'] != 200) {
   generalError(data);
   }
   }

 

 

After fix:

$.ajaxSetup({ type: 'POST', headers: { "cache-control": "no-cache" } });

    var currentTime = new Date();

    var n = currentTime.getTime();

    $.ajax({

   url: 'https://secure.eloqua.com/e/f2?nocache=' + n,
   cache: false,
   type: 'POST',
   headers: { "cache-control": "no-cache" },
   dataType: 'jsonp',
   data: data,
   success: function (data) { generalsuccess(data) },
   error: function (data) {
   if (data['status'] != 200) {
       generalError(data);
   }
   else {
       generalsuccess(data);
   }
   }

    }