Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
Unable to cancel jQuery DataTable Ajax request

I am trying to give the user the ability to cancel the jQuery DataTable(ver 1.10.8) ajax request by pressing the button, but all the solutions i have tried are not giving me the required results. Here is what i have tried :

let table = $('#data-table').DataTable({
                destroy: true,
                responsive: true,
                serverSide: false,
                autoWidth: false,
                paging: true,
                filter: true,
                searching: true,
                stateSave: true,
                scrollX: true,
                lengthMenu: [5, 10, 25],
                language: {
                    "search": "Filtrer: "
                },
                ajax: {
                    url: '/User/GetUsersByDepartment',
                    type: 'POST',
                    data: {
                        QueryValue: departmentName,
                        Type: type
                    },
                    dataSrc: '',
                    
                },
                columns: [
                    {
                        title: 'Display Name',
                        data: 'UserName',
                    },
                    {
                        title: 'Date Joined',
                        data: 'JoinedDate',
                    } 
                  ],
                  initComplete: function (settings, json) {

                    HideSpinner();
                    
                    //Do something with json data;

                  }
               }).order([[1, 'asc']]).draw(false);
 
 
 //..This function is called upon pressing cancel button
 function CancelSearch() {
        table.context[0].jqXHR.abort();
        HideSpinner();
 }

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!