Server side Ajax Post is executing repeatedly

Server side Ajax Post is executing repeatedly

thomaskathomaska Posts: 3Questions: 0Answers: 0

Hi,
I have a datatable getting data from a server side webapi. I found that as soon as the page is loaded and the datatabe is loaded then execute the ajax post method repeatedly probably every 1 second or two. Any suggestions why is this happening, because this is considered as DDOS atack to webapi firewall.

Replies

  • thomaskathomaska Posts: 3Questions: 0Answers: 0
    edited October 10

    Following is the ajax configuration:

    var dt_users = dt_users_table.DataTable({
    ajax: {
    global: false,
    cache: false,
    url: '/Dashboard/Administration/Users/FetchUsers',
    type: 'POST',
    datatype: 'json',
    headers: {
    'X-CSRF-TOKEN': $('#__ejRequestVerificationToken').val()
    }
    },
    processing: true,
    serverSide: true,
    paging: true,
    pageLength: 10,
    searching: true,
    responsive: true,
    ordering: true,
    order: [[1, "asc"]],
    columns: [
    { data: 'id' },
    { data: 'id' },
    { data: 'fullName' },
    { data: 'userName' },
    { data: 'status' },
    { data: 'partnerType' },
    { data: 'phoneNumber' },
    { data: 'twoFactorEnabled' },
    { data: 'dateOfBirth' },
    { data: 'lastLogin' },
    { data: 'action' }
    ]

  • kthorngrenkthorngren Posts: 21,391Questions: 26Answers: 4,961

    There is nothing in your code snippet that would cause Datatables to send multiple ajax requests. Possibly you have something calling draw() or ajax.reload() somewhere. Please post a link to your page or test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • thomaskathomaska Posts: 3Questions: 0Answers: 0
    edited October 10

    Probably was version issue.
    I update the following packages from
    "datatables.net-bs5": "1.13.11",
    "datatables.net-buttons": "2.4.3",
    "datatables.net-buttons-bs5": "2.4.3",
    "datatables.net-fixedcolumns-bs5": "4.3.1",
    "datatables.net-fixedheader-bs5": "3.4.1",
    "datatables.net-responsive": "2.5.1",
    "datatables.net-responsive-bs5": "2.5.1",
    "datatables.net-rowgroup-bs5": "1.4.1",
    "datatables.net-select-bs5": "1.7.1",

    to
    "datatables.net": "2.1.8",
    "datatables.net-bs5": "2.1.8",
    "datatables.net-buttons": "3.1.2",
    "datatables.net-buttons-bs5": "3.1.2",
    "datatables.net-fixedcolumns": "5.0.3",
    "datatables.net-fixedcolumns-bs5": "5.0.3",
    "datatables.net-fixedheader": "4.0.1",
    "datatables.net-fixedheader-bs5": "4.0.1",
    "datatables.net-responsive": "3.0.3",
    "datatables.net-responsive-bs5": "3.0.3",
    "datatables.net-rowgroup": "1.5.0",
    "datatables.net-rowgroup-bs5": "1.5.0",
    "datatables.net-select": "2.1.0",
    "datatables.net-select-bs5": "2.1.0",

    and now had stop the infinity calls. Probably was an issue in v1...

    Thanks for the fast response.

Sign In or Register to comment.