I am new to sencha touch2 and i want to consume external web service in sencha touch2.I have written code for this cause, showing alert msg not working! in console giving error like this XMLHttpRequest cannot load http://localhost/SLS.BRND.Services/Service1.asmx/Helloworld?_dc=1336466078991&method=Helloworld&format=json.
Origin http://localhost:49692 is not allowed by Access-Control-Allow-Origin. app/view/Blog.js?_dc=1336466047687:27Response Status:- 0
please help me what is the problem. Thank you
Here's my code :-
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)
}
});
}
}
}
]
}
});