JSON数据传递
Servlet端代码
try {
while (rs.next()) {
for(int i=0;i<60;i++){
Day[i]+=rs.getInt("Day"+(i+1));
ResolveDay[i]+=rs.getInt("ResolveDay"+(i+1));
}
}
JSONObject member = new JSONObject();
JSONArray listDay = new JSONArray();
JSONArray listResolveDay = new JSONArray();
for(int i=1;i<=60;i++){
listDay.add(Day[60-i]);
listResolveDay.add(ResolveDay[60-i]);
}
// member.put("name", "Submit");
member.put("listDay", listDay);
member.put("listResolveDay", listResolveDay);
members.add(member);
out.write(members.toString());
rs.close();
}
前端获取
<script type="text/javascript">
$(function(){
var projectname="<%=session.getAttribute("projectname_session")%>";
var modelname= document.getElementById("codeid").value;
var url="http://localhost:8080/PAS_V1/DateServlet?currdate="+document.getElementById('enddate').value+"&projectname="+projectname+"&modelname="+modelname;
//alert(url);
$.getJSON(url,function(data) {
var data = [{
name : 'Submit',
value: data[0].listDay,
color:'#f68f70',
line_width:2
},
{
name : 'Resolve',
value: data[0].listResolveDay,
color:'#aad0db',
line_width:2
}
];
});
});
JSON数据传递的更多相关文章
- SpringMVC之json数据传递
json是一种常见的传递格式,是一种键值对应的格式.并且数据大小会比较小,方便传递.所以在开发中经常会用到json. 首先看一下json的格式: {key1:value1,key2:value2} 每 ...
- Spring MVC Json数据传递
json是一种常见的传递格式,是一种键值对应的格式.并且数据大小会比较小,方便传递.所以在开发中经常会用到json. 首先看一下json的格式: {key1:value1,key2:value2} 每 ...
- express后端和fetch前端的json数据传递
在使用express做后端,前端使用fetch API来请求后端时,一般都是用 JSON 数据进行通信的. 下面是一个简单的例子: 前端: if (up) { var passwordAgain = ...
- table显示json数据传递
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jq之ajax以及json数据传递
<html> <head><meta http-equiv="Content-Type" content="text/html; chars ...
- jersey实现RESTful接口PUT方法JSON数据传递
项目中使用的是org.json包 maven中的配置如下: xml <!-- https://mvnrepository.com/artifact/org.json/json --> &l ...
- javascript中 json数据的解析与序列化
首先明确一下概念: json格式数据本质上就是字符串: js对象:JavaScript 中的几乎所有事务都是对象:字符串.数字.数组.日期.函数,等等. json数据的解析: 就是把后端传来的json ...
- 《项目经验》--通过js获取前台数据向一般处理程序传递Json数据,并解析Json数据,将前台传来的Json数据写入数据库表中
先看一下我要实现的功能界面: 这个界面的功能在图中已有展现,课程分配(教师教授哪门课程)在之前的页面中已做好.这个页面主要实现的是授课,即给老师教授的课程分配学生.此页面实现功能的步骤已在页面 ...
- php和js如何通过json互相传递数据
当我们在结合php和javascript实现某些功能时,经常会用到json.json是js的一种数据格式,可以直接被js解析.而php无法直接读取json数据,但是php提供了json_decode函 ...
随机推荐
- Android Binder机制原理(史上最强理解,没有之一)(转)
原文地址: http://blog.csdn.net/universus/article/details/6211589 Binder是Android系统进程间通信(IPC)方式之一.Linux已经拥 ...
- Ubuntu+Django+mod_wsgi+Apache配置过程
Ubuntu15.10 Apache2.4( sudo apt-get install apache2 ) Python3.4( sudo apt-get install apache2 ), [系 ...
- ThinkPad 禁用 触摸板
执行 xinput wowk@wowk:~$ xinput ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTES ...
- js实现url链接encode加密
function urlencode(clearString) { var output = ''; var x = 0; clearString = utf16to8(clearString.toS ...
- python2.7学习记录
一.两个学习网址(2.7已经过时,建议直接学习3) http://blog.csdn.net/longxibendi/article/details/41949215 http://www.liaox ...
- Chapter 2 Open Book——14
I backpedaled. "They seemed nice enough to me. I just noticed they keptto themselves. 我改口说道,他们看 ...
- LeetCode OJ 219.Contains Duplicate 2
Given an array of integers and an integer k, find out whether there are two distinct indices i and j ...
- Java is Pass-by-Value!
Java is strictly pass-by-value. which means, when you pass a variable to a method, the method will j ...
- b端商家赋值权限
- white-space详解
white-space共有5种属性normal,nowrap,pre,pre-wrap,pre-line 网上的解释多半过于详细冗长,先做个简化处理,以便查询 normal 忽略空白 过长换行 ...