很简单的case,部分代码后台java
String proId = request.getParameter("proId");
String resultText = "";
if("1".equals(proId))
{
    resultText = "{success:true,data:{intro:'本产品非常实用'}}";
}
else
{
    resultText = "{success:false,errorMessage:'数据不存在'}";
}
response.getWriter().write(resultText);前台js
buttons:[{
    text:"加载简介",
    handler:function(){
        var params = productForm.getForm().getValues();
        productForm.getForm().load({
          params:params,
          url:"formRequest.jsp",
          method:"GET",
          success:function(form , action){
            Ext.Msg.alert("提示" , "产品简介加载成功");
          },
          failure:function(form , action){
            Ext.Msg.alert("提示" , "产品简介加载失败.原因:" + action.result.errorMessage);
          }
      });
    }
}]错误提示:
You're trying to decode an invalid JSON String: {success:true,data:{intro:'本产品非常实用'}}才弄ext,求帮助,分析下这个json哪里错了.

解决方案 »

  1.   

    这样写:
     resultText = "{success:true,info:'本产品非常实用'}";你要是这样调用的话action.result.errorMessage,
    就在后台这样:
    resultText = "{'errorMessage':'数据不存在'}";
      

  2.   

    我已经知道问题了:
    1。请求的 jsp页面不能包含html代码
    2。返回的字串形式有错 要对key , value使用引号,字符串中使用转义字符
    "{\"success\":\"false\",\"error\":{\"intro\":\"加载失败\"}}"