Not getting success in calling asp.net web service from sencha touch

有些话、适合烂在心里 提交于 2019-12-25 04:21:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!