私は sencha touch2 を初めて使用し、sencha touch2 で外部 Web サービスを使用したいと考えています。この原因のコードを書きましたが、アラート メッセージが機能していません! コンソールで、この XMLHttpRequest cannot load http://localhost/SLS.BRND.Services/Service1.asmx/Helloworld?_dc=1336466078991&method=Helloworld&format=jsonのようなエラーが表示されます。
オリジンhttp://localhost:49692は Access-Control-Allow-Origin で許可されていません。app/view/Blog.js?_dc=1336466047687:27応答ステータス:- 0
何が問題なのか教えてください。ありがとうございました
これが私のコードです:-
Ext.define("GS.view.Blog", {
extend: 'Ext.navigation.View',
xtype: 'blog',
config: {
title: 'WebService',
scrollable: true,
items: [
{
xtype: 'button',
text: 'Press Me',
height: 40,
width: 200,
listeners: {
tap: function () {
// alert("Hi Welcome To Sencha");
Ext.Ajax.request({
method: 'GET',
url: 'http://localhost/SLS.BRND.Services/Service1.asmx/Helloworld',
params: { method: 'Helloworld', format: 'json' },
success: function (response, request) {
alert('Working!')
alert(response.responseText)
console.log('Response:-' + response.responseText)
},
failure: function (response, request) {
alert('Not working!')
console.log('Response Status:- ' + response.status)
}
});
}
}
}
]
}
});