这个javascript函数在IE 9中打开时工作正常,但是当我尝试在Firefox 24.6中打开它时,我收到了ajax失败消息。
var committeeDiv = document.getElementById("committeeDiv");
if(committeeDiv != null){
var url = location.search; // ?com=mc/oc/bic
var com = String(url.substring(url.indexOf("?")+1, url.length)); //com=bic/mc/oc
var id;
var comURL;
if (com != null && com.length > 0){
id = String(com.substring(com.indexOf("=")+1, com.length)); // bic/mc/oc
comURL = 'http://www.example.com/public/content/markets_operations/committees/committee_intros/' + id +'.htm';
}
Ext.Ajax.request({
url: comURL,
method: 'GET',
success: function(response) {
committeeDiv.innerHTML=response.responseText;
},
failure: function(response){
alert("Failed to load Committee Header. Please contact support");
}
});
document.getElementById(id).className = "active"; // highlights current page in menu
这是我遇到的失败。
-
[08:26:48.008] OPTIONS http://www.example.com/public/content/markets_operations/committees/committee_intros/mc.htm?_dc=1407932807608 [HTTP/1.1 403 Forbidden 20ms]
答案 0 :(得分:1)
问题是我正在呼唤外部域名而Firefox并不允许这样做。所以不要使用它:
comURL = 'http://www.example.com/public/content/markets_operations/committees/committee_intros/' + id +'.htm';
这似乎工作正常:
comURL = '/public/content/markets_operations/committees/committee_intros/' + id +'.htm';