Creating json object in javascript and sending it to servlet for getting response

I am creating json object to save data and then sending it to the servlet. But when I try to retrieve the object and display its contents in java servlet, I am not getting any response from server. Even though a simple System.out.println() message on browser.

    angular.module('TestApp').controller('PostController',
        function($scope, $rootScope, $http) {
        $scope.retriveDataAndConvertToJson = function() {
        var collectionJsonData = new Array();
        for (var i = 0; i < rowID.length; i++) {
          collectionJsonData.push({
            "payment_term": document.getElementById("textfield1" + rowID[i])
            .getAttribute("value"),
            "payment": document.getElementById("textfield2" + rowID[i])
            .getAttribute("value"),
            "party": document.getElementById("textfield3" + rowID[i])
            .getAttribute("value"),
            "amount": document.getElementById("textfield4" + rowID[i])
            .getAttribute("value")
          });

        console.log(collectionJsonData[i].payment_term);
        console.log(collectionJsonData[i].payment);
        console.log(collectionJsonData[i].party);
        console.log(collectionJsonData[i].amount);
        console.log("==========================");
      } //End of For loop

      var xhr = new XMLHttpRequest();
      var url = "http://" + document.location.host + "/SivaTask/processInfo";
      console.log("The url is " + url);
      xhr.open("POST", url, true);
      xhr.onreadystatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
          document.getElementById("demo").innerHTML =
            this.responseText;
        }
      };
      var data = JSON.stringify(collectionJsonData);
      xhr.send(data);
    }
  });

Servlet

protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    String contextName = req.getRequestURI();
    String url = contextName.substring(contextName.indexOf('/', 2) + 1);
    System.out.println(url);
    String jsonData = "";
    resp.setContentType("text/plain");
    System.out.println("hello world");
    PrintWriter out = resp.getWriter();
    out.write("The information is : ");
    System.out.println("hello world2");
}

Source: AngularJS