首页 新闻 会员 周边

easyui datagrid直接获取wcf的数据

0
悬赏园豆:30 [已解决问题] 解决于 2015-04-20 16:47

如题,请教easyui datagrid直接获取wcf的数据,好像是跨域的,代码:
前端:
 $('#dgLogRecord').datagrid({
                method: 'get',
              url: 'http://127.0.0.1:8732/Design_Time_Addresses/SysWCFServices/ISysServiceAjax/queryLogRecord',     //这是wcf地址
                fit: true,
                singleSelect: true,
                border: false,
                pagination: true,
                pageSize: 20,
                columns: [[
                    { field: 'user_code', title: '登录帐号', width: '70' },
                    { field: 'logcompany_code', title: '登入分公司', width: '70' },
                    { field: 'Hostname', title: '主机', width: '120' },
                    { field: 'IP', title: 'IP', width: '120' },
                    { field: 'MAC', title: 'MAC', width: '120' },
                    { field: 'lastlogintime', title: '登入时间', width: '120' },
                    { field: 'lastlogouttime', title: '登出时间', width: '120' }
                ]]
            });

WCF代码:
public string queryLogRecord() {
            string strJsonData = "";
            try {
                using (SysDBEntities context = new SysDBEntities())
                {
                    var listLogRecord = context.s_logrecord.ToList();
                    strJsonData = JsonConvert.SerializeObject(listLogRecord);
                }
            }
            catch (Exception ex) { }
            return  strJsonData;
        }
说明:如果通过wcf代理,在ashx文件是可以正常访问的,现在就想在datagrid里直接访问wcf的方法获取数据,有做过的兄弟指点了!

勇哥哥的主页 勇哥哥 | 初学一级 | 园豆:6
提问于:2014-12-29 15:29
< >
分享
最佳答案
0
收获园豆:30
隔壁老王来了 | 初学一级 |园豆:99 | 2014-12-29 16:57
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册