如何在成功函数中从asp.net c#return获取json数据?

如何在成功函数中从asp.net c#return获取json数据?,c#,asp.net,ajax,json,extjs,C#,Asp.net,Ajax,Json,Extjs,我无法在此代码中获取json数据。有人帮我吗 Js代码 success: function (response) { var obj; try { obj = Ext.JSON.decode(response.response.Text); } catch (error) { alert(error); } this.up('form').getForm().reset(); Ext.Msg.alert('Succes

我无法在此代码中获取json数据。有人帮我吗

Js代码

success: function (response) 
{
    var obj;
    try 
    {
        obj = Ext.JSON.decode(response.response.Text);
    } 
    catch (error) { alert(error); }
    this.up('form').getForm().reset();
    Ext.Msg.alert('Success', 'inserted ID: ' + obj.id); <<< I can't get json data 
}
成功:功能(响应)
{
var-obj;
尝试
{
obj=Ext.JSON.decode(response.response.Text);
} 
捕获(错误){警报(错误);}
this.up('form').getForm().reset();

Ext.Msg.alert('Success','inserted ID:'+obj.ID);
obj=Ext.JSON.decode(response.responseText);
对我有效,但您的代码包含一个额外的点(.), 您使用的是
obj=Ext.JSON.decode(response.response.Text);


另外,也不需要编写
Ext.JSON.decode
,您可以使用
Ext.decode

您得到的错误是什么?它是否命中
success
回调或错误?显示实际的AJAX调用,您可能请求错误(如跨域)等。
var keyValues = new System.Collections.Generic.Dictionary<string, string>
{
     { "success", "true" },
     { "id", 'id'}
};

Response.Write(JsonConvert.SerializeObject(keyValues)); <<< return json object
Response.End();