XMLHttpRequest Custom Fields
Author:
Omar Shamali
Writing Date:
Creating XMLHttpRequest in javascript:
var some_var = new XMLHttpRequest();
Adding custom field and value:
some_var.custom_field='some value';
Accessing this custom field:
console.log(some_var.custom_field);
Yet, if you want to access it in onreadystatechange, you need to remember that you will be dealing with "this", as no referenced parameter passed except the xhr that state has been changed, thus, it will be like this:
some_var.onreadystatechange = function() {
console.log(this.custom_field);
}