Why the response status =0 using java struts2

$http({
			method: 'POST',
			url: 'http://test.school.com:8000/checkUser_json.action',
			data: {'username':$scope.username,'password':$scope.password},
			headers: {'Content-Type': 'application/x-www-form-urlencoded'}
		})

		.success(function(data, status, headers, config) {
			alert(status);
			if (data.success= 'true')
			{
				$scope.login_success='success';	
			}
			else
			{
				$scope.login_error='Invalid Email Address/Password';
				
			}
		})
		.error(function(data, status, headers, config) {
			$scope.login_error='Invalid Email Address/Password';
			alert(status);
			
		});

The status zero is when the page is reloading because of the form submission.how can solve the problem

Sorry if I do not fully understand the question, but does the HTTP response itself have a response status of 0? Is the entire webpage being posted to a URL, and its firing ajax at the same time?

1 Like

yes I use nginx server to forward angular ajax to back-end,I don’t know that there is cof between angular and nginx. when I copy js css and index.html into back-end and it works. http://stackoverflow.com/questions/14783277/angularjs-ngingx-cors/17022814#17022814

I use jsonp to send request and pass