Note that there are some explanatory texts on larger screens.

plurals
  1. POchange responseText from a XMLHttpRequest
    primarykey
    data
    text
    <p>i use this code to track all the ajax requests from my site</p> <pre><code>XMLHttpRequest.prototype.uniqueID = function( ) { if (!this.uniqueIDMemo) { this.uniqueIDMemo = Math.floor(Math.random( ) * 1000); } return this.uniqueIDMemo; } XMLHttpRequest.prototype.oldOpen = XMLHttpRequest.prototype.open; var newOpen = function(method, url, async, user, password) { console.log("[" + this.uniqueID( ) + "] intercepted open (" + method + " , " + url + " , " + async + " , " + user + " , " + password + ")"); this.oldOpen(method, url, async, user, password); } XMLHttpRequest.prototype.open = newOpen; XMLHttpRequest.prototype.oldSend = XMLHttpRequest.prototype.send; var newSend = function(a) { var xhr = this; console.log("[" + xhr.uniqueID( ) + "] interceptando envio (" + a + ")"); var onload = function( ) { console.log("[" + xhr.uniqueID( ) + "] interceptando respuesta: " + xhr.status + " " + xhr.responseText.replace(/Pues/g,"NOM:")); //xhr.responseText = "BitBox =&gt; "+xhr.responseText; /*var xhr = { // mock object aborted: 0, responseText: "esto y lo otro....", responseXML: null, status: 0, statusText: 'n/a', getAllResponseHeaders: function() {}, getResponseHeader: function() {}, setRequestHeader: function() {}, abort: function() { log('aborting upload...'); var e = 'aborted'; this.aborted = 1; $io.attr('src', s.iframeSrc); // abort op in progress xhr.error = e; s.error &amp;&amp; s.error.call(s.context, xhr, 'error', e); g &amp;&amp; $.event.trigger("ajaxError", [xhr, s, e]); s.complete &amp;&amp; s.complete.call(s.context, xhr, 'error'); } };*/ }; var onerror = function( ) { console.log("[" + xhr.uniqueID( ) + "] interceptando error: "+xhr.status); }; xhr.addEventListener("load", onload, false); xhr.addEventListener("error", onerror, false); xhr.oldSend(a); } XMLHttpRequest.prototype.send = newSend; </code></pre> <p>But it only works on fire, not ie nor chrome.</p> <p>Anyone can help me with this issue or knows another form of track the responseText of any ajax request?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload