server端用的是php作为接口,在post数据的接口处加上下面代码:
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: X-Requested-With');
在angularjs处$http要按照下面方式写:
$http({ url:'http://www.xxx.com/index.php?app=api&ac=user&ts=login', method:"POST", headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, data: { 'email': 'root@qq.com','password': '123456' } });
jsonp 跨域的问题
http://www.thinksaas.cn/topics/0/201/201105.html