$.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
}
})
Shouldn’t these two have exactly the same meaning? Why can it be executed successfully when using ajax, but when using $http, it prompts a cross-domain error?
The method I found, the speed test was successful
Angular uses jsonp cross-domain, of course, the premise is that your server returns jsonp format.