我使用GET请求通过http打了一个url。我使用下面的代码。从javascript获取http呼叫时失败
onReady: function() {
var makeAjaxRequest = function() {
var myUrl = encodeURI('http://domainname/VW-MAPP/fgnwasxuyu/10548168/2012-04-11 12:42:36/5555');
Ext.Ajax.request({
method: 'get',
url: myUrl,
success: function(response) {
alert(''+response.responseText);
console.log("response:-"+response.responseText); },
failure: function (response) {
console.log("Failure");
console.log("response status:-"+response.status);
alert("Failure");
}
});
};
new Ext.Panel({
fullscreen: true,
id: 'content',
scroll: 'vertical',
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items: [{
text: 'XMLHTTP',
handler: makeAjaxRequest
}]
},{
id: 'status',
xtype: 'toolbar',
dock: 'bottom',
title: "Tap a button above."
}]
});
}
});
我尝试了很多,但得到以下错误
的XMLHttpRequest无法加载// // URLNAME。 Access-Control-Allow-Origin不允许原始位置为null。
如果任何人有任何想法请帮助。
感谢
或者,如果他必须访问其他系统,请发送正确的标题。 – ThiefMaster
嗨Diodeus,非常感谢回应。你能告诉我该怎么做才能避免这种浏览器行为?我怎样才能使服务器的ajax调用? – Gendaful
使用PHP,您可以使用CURL,但我不知道您用作服务器的是什么。 –