Viewing AJAX arguments in the JS Console

This snippet has to be run after jQuery. For BIC v2, I put this in a

JavaScript-hosting interaction and link the interaction in

externalJavaScript in answerSpace Setup.

 

Then all you need to do is use the answerSpace, submit forms, etc and

you'll see (in the console) exactly how jQuery.ajax() was invoked each

time. This is particularly handy with Forms v2 because breakpoints are

not possible.

ajax-spy.js
(function () {

  'use strict';

  var oldAjax = $.ajax;

  $.ajax = function () {

    if (window.console && console.log) {

      console.log(arguments);

    }

    return oldAjax.apply($, arguments);

  };

}());

ajax-timeout.js
 
(function () {

  'use strict';

  var oldAjax = $.ajax;

  $.ajax = function () {

    var options = arguments[0];

    if (options && typeof options === 'object') {

      options.timeout = 5 * 60 * 1000; // 5 minutes

    }

    if (window.console && console.log) {

      console.log(arguments);

    }

    return oldAjax.apply($, arguments);

  };

}());