ionic 发送POST请求 发表于 2015-07-22 | 分类于 Ionic | 今天写一个POST请求给远程API,FORM数据一直不能发送,最终用如下factory解决问题: 12345678910111213141516171819202122.factory('LoginService', ['$http', function($http) { var users = []; return { getUsers: function(loginData) { var username = loginData.username, password = loginData.password; return $http({ method: 'POST', url: 'http://172.16.100.222/zf/app/login.php?act=login', data: $.param(loginData), headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).success(function(response) { // debugger users = response; return users; }); } } }])