首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

后台怎么传递两个值给前台Ext

2014-01-08 
后台如何传递两个值给前台Ext我写了一个上传图片,上传成功后前台要获取到图片的路径,不知道怎么把值传给前

后台如何传递两个值给前台Ext
我写了一个上传图片,上传成功后前台要获取到图片的路径,不知道怎么把值传给前台。。。请大家帮帮忙看看。。
前台部分代码: listeners: {
                            'click': function addFile(o) {
                                var form = Ext.getCmp("usermanage-addprisoner-form").getForm();
                                if (form.isValid) {
                                    //Ext.Ajax.request
                                    form.submit({
                                        url: 'data/test.ashx',
                                        // 'data/upload.ashx'
                                        method: 'POST',
                                        waitMsg: '正在上传',
                                        success: function () {
                                            Ext.Msg.alert('提示', '上传成功');
                                            //                                            var obj = response.responseText;
                                            //                                            var arr_obj = obj.split('@');
                                            //                                            if (arrobl[0] == "success") {
                                            //                                                Ext.Msg.alert("上传成功");
                                            //                                                Ext.getCmp("box_picture").getEl().dom.src = arr_obj[1];
                                            //                                            }


                                        },
                                        failure: function () {
                                            Ext.Msg.alert('提示', '上传失败');
                                            //window.location.reload();
                                        }
                                    }
后台代码:       if (("," + upext + ",").IndexOf("," + fileExtension + ",") < 0)
                                throw new Exception("上传文件扩展名必需为:" + upext);
                                postedPath=savePath + "\" + fileName;
                                postFile.SaveAs(postedPath);
                        }
                    }
                    json = "{success:true}";

后台的json怎么把路径postedPath一同传递给前台?????
[解决办法]
后台拼成json格式 如:
{"typeid":"9","typename":"体育/运动"}

前台:
var json=eval(response.responseText);
var v1=json.typeid;
var v2=json.typename;

这代码不难,应该可以看懂吧。

热点排行