jquery ajax成功部署后功能响应为空。

时间:2015-09-24 13:44:56

标签: jquery asp.net json ajax wcf

我在我的项目中使用jquery ajax函数,在那个静态方法我连接到wcf服务。在local_host中,我从静态方法获得结果。在部署到iis后,预期结果不会到来。

**ClientSide Code:**

$.ajax({
    url: 'SearchResults.aspx/GetSearhResult',
    type: 'POST',
    data: JSON.stringify({ SearchKey: searchKey, ActionName: action }),
    contentType: 'application/json; charset=utf-8',
    dataType: 'json',
    success: function (response) {
//while debugging in browser this response is showing empty
            if (response.d != "") 
            {
              var obj = JSON.parse(response);
              **here i am binding result to html table**
            }
    },
    error: function (a,b,c) {
                        }
                    });


**ServerSide Code:**

[WebMethod]
public static string GetSearhResult(string SearchKey,string ActionName)
{
**Here i am connecting to wcf service In that service executing one stored procedure i am converting result into json string**
 retun Newtonsoft.Json.JsonConvert.SerializeObject(object);
}

**Note:** i connected deployed wcf service in local_host using endpoints at that time i am getting result.

0 个答案:

没有答案