java 返回 JSON给JS
2016-04-06 00:00
507 查看
JAVA:
JS:
JSONObject json = new JSONObject(); json.append("decodeContent", decodeContent);//decodeContent在我这里是个字符串,append(String key, object value); out.println(json.toString()); //或者输出字符串 out.println("{\"decodeContent\":\""+decodeContent+"\"}");
JS:
//这个response是回调参数 response = JSON.stringify(response);//将对象转换为JSON字符串,这时候可以直接打印 response = JSON.parse(response); //将JSON字符串解析为JSON对象 console.log('decodeContent:'+response.decodeContent);//打印对象指定key的value
相关文章推荐
- java对世界各个时区(TimeZone)的通用转换处理方法(转载)
- java-注解annotation
- java-模拟tomcat服务器
- java-用HttpURLConnection发送Http请求.
- java-WEB中的监听器Lisener
- Android IPC进程间通讯机制
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- 介绍一款信息管理系统的开源框架---jeecg
- Extjs4.0 最新最全视频教程
- 聚类算法之kmeans算法java版本
- java实现 PageRank算法
- Javascript中toFixed方法的改进
- PropertyChangeListener简单理解
- c++11 + SDL2 + ffmpeg +OpenAL + java = Android播放器
- 插入排序
- 冒泡排序
- 堆排序