jquery datatable reload new data from ajax call

During page load I display a datatable with data called from ajax referencing a webmethod
An action is performed on a selected item and then another ajax call updates the sql table where the main table data
is displayed.
I'm looking to refresh the datatable with the newest data during a close action
ajax.reload() not working me

Help please!!

This is the function I'm calling during my close on click event

function RefreshIBKHealth(region) {
        var report = 1;
        var machine = null;
        var userid = null;
        var parameters = "{'report':'" + report + "','region':'" + region + "','machine':'" + machine + "','userid':'" + userid + "'}";
 
        var myTable = $('#GlobalIBKHealthAMRS').DataTable({
            'deferRender': true,
                    'bFilter': true,
                    'bSearchable': true,
                    'bProcessing': true,
                    'bRetrieve': true,
                    'bSortable': true,
                    'bAutoWidth': false,
                    'bDestroy': true,
                    'stripeClasses': [],
                    'aoColumns': [
                                { 'mDataProp': 'Machine', 'sClass': 'center' },
                                { 'mDataProp': 'LastContactTime', 'sClass': 'center' },
                                { 'mDataProp': 'machinePowerUpStatus', 'sClass': 'center' },
                                { 'mDataProp': 'registrationStatus', 'sClass': 'center' },
                                { 'mDataProp': 'LastDeRegistrationReason', 'sClass': 'center' },
                                { 'mDataProp': 'NBK', 'sClass': 'center' },
                                { 'mDataProp': 'environment', 'sClass': 'center' },
                                { 'mDataProp': 'Region', 'sClass': 'center' },
                                { 'mDataProp': 'MaintenanceMode', 'sClass': 'center' },
                                { 'mDataProp': 'Name', 'sClass': 'dpass', 'bSearchable': false }
                                ],
                    'aoColumnDefs': [
                                { "sWidth": "10%", "aTargets": [0] },
                                { "sWidth": "20%", "aTargets": [1],
                                    "mRender": function (data, type, row) {
                                        if (row.LastContactTime != null) {
                                            var arr = row.LastContactTime.split(/[- :T]/); // from your example var date = "2012-11-14T06:57:36+0000";
                                            strdate = new Date(arr[0], arr[1] - 1, arr[2], arr[3], arr[4], 00);
                                            var formatdate = formatDateTime(strdate);
                                            if (data != null) {
                                                return formatdate
                                            }
                                        }
                                        else {
                                            return "Not Available";
                                        }
                                    }
                                },
                                { "sWidth": "5%", "aTargets": [2] },
                                { "sWidth": "10%", "aTargets": [3] },
                                { "sWidth": "20%", "aTargets": [4] },
                                { "sWidth": "20%", "aTargets": [5],
                                    "mRender": function (data, type, row) {
                                        var ldesc = 'Click to obtain further details on standard ID';
                                        var vmhvd = row.Machine
                                        var description = ldesc.replace(/\s+/g, ' ');
                                        if (data != 'ID-NA') {
                                            return '<a href="#" onclick=loadHRDetails("' + vmhvd.trim().replace(/ /g, '!') + '","' + data + '"); return false; rel="tooltip" data-placement="bottom" title=' + description + '>' + data + '</a>'
                                        }
                                        else
                                            return data
                                    }
                                },
                                { "sWidth": "5%", "aTargets": [6] },
                                { "sWidth": "5%", "aTargets": [7] },
                                { "sWidth": "10%", "aTargets": [8] }
                                ],          
                 
                        'ajax': {
                            type: "POST",
                            url: "VDRService.asmx/GlobalIBKHealth",
                            contentType: "application/json; charset=utf-8",
                            data: parameters,
                            dataType: "json"
                        }
        });
       
        myTable.ajax.reload();       
       
        }
 

Open in new window

LVL 4
Mauro CazabonnetSenior .NET Software EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zephyr_hex (Megan)DeveloperCommented:
try using fnDraw() to redraw the table, instead of ajax.reload().  So, change line 75 above to:

myTable.fnDraw();

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mauro CazabonnetSenior .NET Software EngineerAuthor Commented:
Yes, I went this direction. I created another function strictly repopulating the table data only

thx!!
Jack FernCommented:
Good Answer it worked thanks.....
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AJAX

From novice to tech pro — start learning today.