I am trying to validate a number input using angularjs.
The page works as desired by itself, however it does not work when I call the page with ajax.
Any help or advice would be appreciated!

Working angularjs jlgtest3.jsp ...

```
<div ng-app="total">
<script>
angular.module('total', [])
.controller('totalController', ['$scope', function($scope) { }]);
</script>

<form name="totalForm" ng-controller="totalController">
<input name="totalHours" ng-model="total" type="number" value="" />
<p ng-show="totalForm.totalHours.$error.number">Not valid number!</p>
</form>
</div>
</html>

```

Not working with ajax call (jlgtest4.jsp calling jlgtest3.jsp)...

```
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script>
function newajax() {
var xRequest1;
    if(window.XMLHttpRequest)
    {
        xRequest1=new XMLHttpRequest();
    } else {
        xRequest1=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xRequest1.onreadystatechange=function ()
    {
        if((xRequest1.readyState==4) && (xRequest1.status==200))
        {
            document.getElementById("test").innerHTML=xRequest1.responseText;
        }
    }
    var urlencode = "jlgtest3.jsp";

    xRequest1.open("post",urlencode,true);
    xRequest1.send();   
}
</script>
</head>

<input type="button" onclick="newajax()" value="button" />
<div id="test">

</div>
</html>

```

I attempted the angular ajax call as some people suggested, but I couldnt get it to work...

```
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>

<div ng-app="total">
<script>
angular.module('total', [])
.controller('totalController', ['$scope', function($scope) {
    $http.POST("jlgtest3.jsp").then(function(response) {
        $scope.test = response.data;
    });
 }]);
</script>
<div ng-controller="totalController">
<input type="button" value="button" />
{{test}}
</div>

</div>
</html>

```