$http post 取不到数据
默认情况下,jQuery传输数据使用Content-Type: x-www-form-urlencoded 和类似于"foo=bar&baz=moe"的序列,然而AngularJS,传输数据使用Content-Type: application/json和{ "foo": "bar", "baz": "moe" }这样的json序列。
$http({
method: 'POST',
url: '',
data: serializeParam({
"a": 'a',
"b": JSON.stringify([1,2,3])
}),
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
}
}).success(function(json) {
}).error(function() {})
$http({
method: 'GET',
url: '',
params: {
"a": 'a',
"b": 'b'
}
}).success(function(json) {
}).error(function() {})
随机推荐
- JS面向对象基础
以往写代码仅仅是为了实现特定的功能,后期维护或别人重用的时候,困难很大. Javascript作为完全面向对象的语言,要写出最优的代码,需要理解对象是如何工作的. 1. 对象是javasc ...
- 计算机学院大学生程序设计竞赛(2015’12) 1003 The collector’s puzzle
#include<cstdio> #include<algorithm> using namespace std; using namespace std; +; int a[ ...
- [Big Data]hadoop分布式系统在Linux系统安装
待完善 Hadoop2.6.0部署与应用 一. 环境准备 硬件:3台虚拟机 内存:至少512MB 硬盘:至少20G 操作系统:rhel6.4 64位 最小化安装 主机名 IP(局域网) 描述 ...
- Spring--AOP--面向切面编程
AOP: 面向切面编程. 通过动态代理实现. AOP就3条线, 2条线给剪断. 实现:动态代理 如果实现interface的话, 用Proxy, InvocationHandler. 不实现inter ...
- Content Provider 小结
Android中的四大组件之一ContentProvider,它支持多个应用间进行存储和读取数据等操作,实现不同应用间的数据共享. ContentProvider,解释为内容提供商.顾名思义,就是对外 ...
- (中等) POJ 1054 The Troublesome Frog,记忆化搜索。
Description In Korea, the naughtiness of the cheonggaeguri, a small frog, is legendary. This is a we ...
- 使用USBASP给Arduino烧写bootloader教程
源:使用UsbAsp给UNO烧写bootloader ATMEGA16U2.ATMEGA328P固件烧写教程 arduino板由于操作不发导致固件损坏,或者想更新固件怎么办?今天给大家介绍一下如何使用 ...
- linux 驱动入门2
不吃苦中苦,难为人上人.努力,给老婆孩子提供个良好的生活居住环境. http://www.cnblogs.com/nan-jing/articles/5775038.html 这里提到.有这么多牛人. ...
- Html标签中Alt和Title都是提示性语言标签
在Html标签中Alt和Title都是提示性语言标签,在我们浏览一些网页时,鼠标停留在一张图片或文字链接上时,在鼠标的右下角出现一个提示信息框,对目标进行一定的注释说明,这就是它们的作用. 其中 ...
- bzoj3110: [Zjoi2013]K大数查询 【cdq分治&树套树】
模板题,折腾了许久. cqd分治整体二分,感觉像是把询问分到答案上. #include <bits/stdc++.h> #define rep(i, a, b) for (int i = ...