我有以下无法覆盖的功能:
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("");
}
}
如何将多个标题(aHeaders
)传递给此函数?如果我将Content-Type
作为标题传递,它会覆盖默认值(application/x-www-form-urlencoded
)吗?
我想传递两个标题:
x-myheader-value
:zzz1111bbb
content-type
:application/javascript