웹 서비스에 양식을 게시 한 후 아래의 각 http 게시 결과는 두 HTML 요소 중 하나를 트리거하여 성공 또는 실패를 표시합니다. 게시물. "Success"문자열과 함께 200 OK 응답을 받고 있지만 성공 HTML 요소는 성공하지 못한 것처럼 표시되지 않습니다. 아무도 여기서 내가 빠진 것을 지적 할 수 있니? 나는 그것을 고맙게 생각할 것이다.
JQuery와 :
$scope.demoInquiry = function(){
$http({
method : 'POST',
url : 'http://localhost:XXXXX/XXX/XXXXXXX/XXXXXXXXXX',
data : $.param({
firstName : $scope.firstName,
lastName : $scope.lastName,
companyName : $scope.companyName,
email : $scope.email,
phone : $scope.phone,
deviceHwid : "Website Inquiry"
}),
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
}).success(function(data) {
console.log(data);
$scope.postSuccess = true;
}).error(function(data){
console.log(data);
$scope.postError = true;
});
};
HTML :
<div class="row" ng-show="postSuccess">
<div class="col-lg-9 col-lg-offset-3 col-xs-12 hidden">
<span id="demoSuccessResult" style="color: blue;">Thank you for registering!</span>
</div>
</div>
<div class="row" ng-show="postError">
<div class="col-lg-9 col-lg-offset-3 col-xs-12 ">
<span id="demoErrorResult" style="color: red;">There was an error with your registration. Try again.</span>
</div>
</div>
dom 요소의 범위가 postSuccess를 설정 한 위치와 동일합니까? – Fordio