$(function(){

     $.ajax({
type: "post",
url: "${ctx}/modules/fos/reference/echart",
//dataType:'json',
success: function(data) {
var option=$.parseJSON(data);
formatter(option);
var myChart = echarts.init(document.getElementById('main'));
myChart.setOption(option);
}
}); //将option中的function字符串类型转为函数
function formatter(option){
if((typeof option)=="object"){
for(var o in option){
var opt=option[o];
if((typeof opt)=="string"){
if(opt.indexOf("function")!=-1){
//"string"转为"function" eval
var fmt=eval("("+opt+")");
option[o]=fmt;
}
} formatter(opt);
}
}
}
});

递归算法的实质是把问题分解成同类问题的规模缩小的子问题,然后递归调用方法来表示问题的解,把一个大的复杂的问题层层转换为一个小的和原问题相似的问题.

http://blog.csdn.net/agileclipse/article/details/8551228

后台返回字符串类型function的处理 (递归算法)的更多相关文章

  1. ajax请求后台返回map类型并如何展示

    前台jsp或者ftl文件接收返回结果: <input type="hidden" name="selectedModelListStr" id=" ...

  2. Struts2+Jquery实现ajax并返回json类型数据

    来源于:http://my.oschina.net/simpleton/blog/139212 摘要 主要实现步骤如下: 1.JSP页面使用脚本代码执行ajax请求 2.Action中查询出需要返回的 ...

  3. dbda封装类(包括:返回二维数组、Ajax调用返回字符串、Ajax调用返回JSON)

    <?php class DBDA { public $host = "localhost"; public $uid = "root"; public $ ...

  4. 转载:Struts2+Jquery实现ajax并返回json类型数据

    摘要: 主要实现步骤如下: 1.JSP页面使用脚本代码执行ajax请求 2.Action中查询出需要返回的数据,并转换为json类型模式数据 3.配置struts.xml文件 4.页面脚本接受并处理数 ...

  5. [python] 查询mysql返回datetime类型数据的处理

    Python 查询Mysql,如果是datetime类型,在json序列化的时候会出现问题. 在网上查了一下,解决方案基本都是遍历dict数据,如果是datetime则转化为字符串. from dat ...

  6. Redis常用命令入门1:字符串类型命令

    Redis总共有五种数据类型,在学习的时候,一定要开一个redis-cli程序,边看边练,提高效率. 一.最简单的命令 1.获得符合规则的键名列表 keys * 这里的*号,是指列出所有的键,同时*号 ...

  7. python字符串类型

    python中的字符串 python中的字符串类型为str,也是平时操作的类型.但除了str类型,还有一个专门的名为"string"的模块(导入即可知),是很早以前没有str类型的 ...

  8. return 返回字符串

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...

  9. vb6如何调用delphi DLL中的函数并返回字符串?

    1,问题描述 最近发现vb6调用delphi DLL中的函数并返回字符串时出现问题,有时正常,有时出现?号,有时干脆导致VB程序退出 -- :: 将金额数字转化为可读的语音文字:1转化为1元 ???? ...

随机推荐

  1. XproerIM V2开源,基于XproerUI引擎构架

    资源下载:XproerIM源代码(访问密码:2e47),imServer(访问密码 364c), 技术交流群:6259765 技术支持:3040217208 咨询邮箱:2190615607@qq.co ...

  2. 如何理解JS回调函数

    1.回调函数英文解释: A callback is a function that is passed as an argument to another function and is execut ...

  3. 【转】HTML转义字符大全

    ISO Latin-1字符集:  — 制表符Horizontal tab  — 换行Line feed  — 回车Carriage Return  — Space ! ! — 惊叹号Exclamati ...

  4. VC++ 截屏代码,并保存为想要的格式(BMP,JPG,PNG,GIF等格式)

    void CCaptionScreenDlg::Screen(char* filename) { HDC hdcSrc = ::GetDC(NULL); int nBitPerPixel = GetD ...

  5. 高仿淘宝和聚美优品商城详情页实现《IT蓝豹》

    高仿淘宝和聚美优品商城详情页实现 android-vertical-slide-view高仿淘宝和聚美优品商城详情页实现,在商品详情页,向上拖动时,可以加载下一页. 使用ViewDragHelper, ...

  6. requireJS的引用

    main.js: require.config({ paths: { jquery: 'jquery-1.7.2', biz: 'biz', }}); require(['jquery', 'biz' ...

  7. Direct2D相关

    1,如何绘制文本 2,文本格式设置和布局

  8. PDF打水印加密

    using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using S ...

  9. Pow 算法

    #include <iostream> using namespace std; template<class T, class Int> T Pow(T x, Int n) ...

  10. LoadRunner参数更新方法和数据分配

    参数化的定义:使用指定的数据源中的值来替换脚本录制生成的语句中的参数. 对Vuser脚本进行参数化的好处: 1.减小脚本的大小 2.提供了使用不同的脚本的值执行脚本的能力 参数化涉及两个任务: 1.用 ...