我想把后台查到的数据返回到前台的文本框中 ,为什么这样取不到值?应该怎么取?
Ext.getCmp("参数名").setValue(Ext.util.JSON.decode(response.responseText).参数名);

解决方案 »

  1.   

    先alert(response.responseText),是否可以转换成对象
      

  2.   

    alert出来的不是undefined就是object
      

  3.   

    我把报错信息抄下来把
    Microsoft Internet Explorer
    [object Object]
      

  4.   

    你先用console.log(response.responseText) 看看另外,如果是FORM要获得返回JSON,则可以用 getCmp('Form').loadRecord(JSON)
    当然 form 的field的name 需和JSON的返回一样
      

  5.   

    不是form 是grid以前是调用接口的都是这样取的
    Ext.getCmp("前台界面控件的id").setValue(Ext.util.JSON.decode(response.responseText).前台界面控件的id);
    比如:手机号码
    Ext.getCmp("serial_number").setValue(Ext.util.JSON.decode(response.responseText).SERIAL_NUMBER);
    但是现在不调用接口了 为什么这样就取不到?
    Ext.getCmp("").setValue("1");这样把值写死就可以得到
      

  6.   

    你首先看看alert(Ext.util.JSON.decode(response.responseText).SERIAL_NUMBER)有没有啊 。
    如果是undefined就没有了。
      

  7.   

    是undefined的 所以我现在写死了数据根本不是从后台返回的
      

  8.   

    用FF + FIREBUG,或谷歌,把
    Ext.getCmp("serial_number").setValue(Ext.util.JSON.decode(response.responseText).SERIAL_NUMBER);直接替换成console.log(Ext.util.JSON.decode(response.responseText)),
    然后该对象的属性什么的,都在里头
      

  9.   

    cs文件 Response.Write(result);
     Response.End();aspx文件<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GetFhxx.aspx.cs" Inherits="URL_Fhxx_GetFhxx" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
        </div>
        </form>
    </body>
    </html>用这种方式AddFcqdForm.getForm().findField("fhqdh_add").setValue(response.responseText); 这样就可以直接赋值了