问题
Here's my code which i am using to get data from web service:-
Ext.onReady(function(){
var url = "http://192.168.1.15/JSONDemo/Service1.asmx/getString";
Ext.Ajax.request({
method: 'get',
url: url,
// params: {'name':'himanshu'},
jsonData: { 'name': 'Himanshu'},
// headers: { 'Content-Type': 'application/xml; charset=utf-8' },
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)
}
});
});
my .net web service code is here:-
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
public string getString(string name)
{
return "Hello "+name;
}
I am getting no response with this code with '0' response status.Please help me get rid of the problem.
回答1:
Are you able to get data from your service using a web browser? When using http get you should pass the parameters to the method in query string. Is sencha passing the parameters in query string? Best regards
来源:https://stackoverflow.com/questions/9583772/not-getting-success-in-calling-asp-net-web-service-from-sencha-touch