明明很简单的东西,可惜网上一大堆废话。在此记录,转需。

 jsonStr = JSON.stringify(jsondata,null,);

example:

<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]>
<html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]>
<html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]>
<html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8"> <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
Remove this if you use the .htaccess -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>flow CURD测试</title> <!-- Mobile viewport optimized: j.mp/bplateviewport -->
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- CSS: implied media="all" -->
<load href="/api/Application/Habo_v2/View/Index/style.css"/>
<load href="__PUBLIC__/css/bootstrap.min.css" />
<load href="__PUBLIC__/js/jquery.js" />
<load href="__PUBLIC__/js/bootstrap.min.js" /> <!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects --> </head> <body class="home"> <div class="container">
<header>
<h3>flow CURD 接口测试</h3> </header> <form>
<div class="form-group">
<label for="flowid">FlowId:</label>
<input id="flowid" type="text" class="form-control" placeholder="input flowid here">
</div>
<div class="form-group">
<label for="flowdata">Example jsondata</label>
<textarea id="flowdata" class="form-control bg-muted code" rows="18" placeholder="Input flow json data here"></textarea>
</div>
<div class="form-group row">
<button id="createflow" type="button" class="btn btn-primary col-md-2 col-md-offset-2">新建</button>
<button id="updateflow" type="button" class="btn btn-primary col-md-2">修改</button>
<button id="searchflow" type="button" class="btn btn-primary col-md-2">查找</button>
<button id="deleteflow" type="button" class="btn btn-primary col-md-2">删除</button>
</div>
</form> <div class="clear"></div>
</div> <footer>
<div id="footer">
Copyright &copy;
<script type="text/javascript">
d = new Date();
document.write(d.getFullYear());
</script>
<span>Habo, Inc. All rights reserved.</span><br/>
Generated by <a href="http://Habo.oa.com">Habo</a>.
</div>
</footer>
</div> <!--! end of #container --> <script>
$(function(){
$("#searchflow").click(function(){
var flow_id = $("#flowid").val();
var param = {
'flow_id' : flow_id
};
console.log("flowID",flow_id);
$.getJSON("/api/index.php/Habo_v2/DiyApi/getFlowData",data=param, function(jsondata){
jsonStr = JSON.stringify(jsondata,null,4);
$("#flowdata").val(jsonStr);
console.log("flowData: ",jsondata);
});
});
})
</script> </body>
</html>

利用js将 json对象在textarea中赋值与展示的更多相关文章

  1. js 替换json对象中的键名

      js 替换json对象中的键名 CreateTime--2018年3月30日15:38:50 Author:Marydon 情景描述: 有个json数组,现在需要将json对象中的key替换掉,值 ...

  2. 类对象传输到jsp页面。需要转换为js的json对象时,这么做。

    场景:要从一个列表中选择信息,填写入父页面的表单中,但是字段非常多... 后台查询,得到结果,放在列表中. 效果:点击选择产品.. 弹出页面:点击后面的选择产品 选择产品后:信息自动填充.. 实现:点 ...

  3. Js拼Json对象

     我们通常会拼字符串,但是拼字符串的话,遇见占位符会出错.  下面分享一个拼js拼json对象的方法:          var jsonArr = [];                     $ ...

  4. js遍历json对象

    原生js遍历json对象 遍历json对象: 无规律: <script> var json = [ {dd:'SB',AA:'东东',re1:123}, {cccc:'dd',lk:'1q ...

  5. JAVA利用反射映射JSON对象为JavaBean

    关于将JSONObject转换为JavaBean,其实在JSONObject中有对于的toBean()方法来处理,还可以根据给定的JsonConfig来处理一些相应的要求,比如过滤指定的属性 //返回 ...

  6. js 将json对象转成字符串

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. javascript、js操作json对象和字符串互相转换方法

    相信前端的同学们对json并不陌生,接触过很多.但是很少人知道json的全称是什么,哈哈,我也是查资料知道的.(JSON JavaScript Object Notation是一种轻量级的数据交换格式 ...

  8. js:JSON对象与JSON字符串转换

    JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式,采用完全独立于语言的文本格式,是理想的数据交换格式. 同时,JSON是 JavaScript 原生格式,这 ...

  9. 【Js】JSON对象、JSON字符的使用总结

    JSON对象 / JSON字符串区别 抛出一个最常见的疑问:什么是“JSON对象”,什么是“JSON字符串”,它俩的区别是什么? 废话不多说,直接上代码. 1.JSON对象: // javascrip ...

随机推荐

  1. PostgreSQL and bloat

    The bucardo project has released its nagios plugins for PostgreSQL and we can extract from them this ...

  2. 关于jquery easyui treegrid的问题

    我是用的django web开发架构: 想实现如下功能: 权限架构 点击checkbox时,能获取该checkbox的值: 代码如下: <tr> <th field="na ...

  3. PHP 文件迭代器

    使用了SPL的 迭代器, 可以直接对打开的文件进行foreach读取, 类的构造如下 class fileIterator implements Iterator { private $fp; pri ...

  4. HTML5服务器推送事件

    目前客户端(浏览器)和服务端交互大致有以下几种方式: 1)form表单提交方式,适合访问量不大,对用户体验要求不高的web系统开发,或者页面整体刷新无伤大雅的场合,通信方向是客户端提交给服务端,是客户 ...

  5. 详解Linux安装GCC方法

    转载自:http://blog.csdn.net/bulljordan23/article/details/7723495/ 下载: http://ftp.gnu.org/gnu/gcc/gcc-4. ...

  6. Android 打包签名 从生成keystore到完成签名 -- 转

    首先,我们需要一个keystore,当然已经有了的话就不用这一步了:cmd下:进入到jdk的bin目录,这样的话,android.keystore文件就会生成在这个目录下,签名的时候我们需要这个文件C ...

  7. oracle分析函数 之分组累加求和

    select s.slice_date_to ,s.made_id ,sum(s.steup_count)over(partition by s.made_id order by s.slice_da ...

  8. MySQL使用Union创建视图报错

    mysql> select * from test_main; +----+-------+ | id | value | +----+-------+ |  1 | ONE   | |  2  ...

  9. Python 从sketch中读取文件

    =============================== RESTART: Shell =============================== >>> import o ...

  10. Highcharts 功能强大、开源、美观、图表丰富、兼容绝大多数浏览器的纯js图表库

    http://www.hcharts.cn/index.php 暂无介绍,等待后续补充