I am struggling with a function that cannot be overridden:
getHtml:function(aURL,aPostData,aHeaders,aMethod){
this.xhr = new XMLHttpRequest();
var tmp=this;
this.xhr.onreadystatechange=function(){
tmp.onStateChange();
};
if(aPostData||aPostData==""){
this.xhr.open(aMethod?aMethod:"POST", aURL, true);
this.xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
}else this.xhr.open(aMethod?aMethod:"GET", aURL, true);
if(aHeaders){
for(var t in aHeaders){
this.xhr.setRequestHeader(t,aHeaders[t]);
}
}
try{
this.xhr.send(aPostData);
}catch(e){
this.doNext("");
}
}
What is the correct way to pass multiple headers (aHeaders
) to this function? If I include Content-Type
as a header, will it replace the default value (
application/x-www-form-urlencoded
)?
I need to pass two headers:
x-myheader-value
:zzz1111bbb
content-type
:application/javascript