How to bind loaded data to datatable???

How to bind loaded data to datatable???

AmirSarvestaniAmirSarvestani Posts: 5Questions: 2Answers: 0

I am trying to load a json which is a servlet response made by "ObjectMapper mapper" . All i do is submit a button which send a Post to a servlet and the response is a Json created by Hackson FasterXmL. I want to update the table when I get the response but have had no luck populating the table. Can Anyone Pleeease help me??

Answers

  • AmirSarvestaniAmirSarvestani Posts: 5Questions: 2Answers: 0
    edited February 2017

    $scope.sendPost = function () {
    $http({
    url: './servlets/SearchCustomerServlet',
    method: "POST",
    data: {
    'businessName': $scope.businessName,
    'lastName': $scope.lastName,
    'emailAddress': $scope.emailAddress,
    'mobileNumber': $scope.mobileNumber
    }
    }).then(function (data) {

                     updateTable(data);
                        });
    
                    };
    

    This is my Angular Post

  • AmirSarvestaniAmirSarvestani Posts: 5Questions: 2Answers: 0
    edited February 2017

    function updateTable(dataitems) {
    $('#myTable').DataTable({
    "data" data,
    "columns": [
    {"data": "firstName"},
    {"data": "lastName"}
    ]
    });
    }

  • AmirSarvestaniAmirSarvestani Posts: 5Questions: 2Answers: 0

    This is how I update the table. Please any help is much appreciated.

This discussion has been closed.