$.ajax({
url: api.regist,
type: 'POST',
dataType: 'json',
data: {
email: $scope.email,
password: $scope.password
}
})
$http({
url: api.regist,
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
data: {
email: $scope.email,
password: $scope.password
}
})
這兩個不應該是完全一樣的意義嘛?為什麼使用 ajax 可以執行成功,但使用 $http 就提示跨域了呢?
自己找到的方法,測速成功
angular跨域使用 jsonp,當然前提是你的伺服器回傳的是 jsonp 格式。