.destroy() is not working.

.destroy() is not working.

Abhi RAbhi R Posts: 17Questions: 5Answers: 0

Hello All,
This is ajax code below

$.ajax({
        url: "/ModalDisplay/UpdateMeeting/",
        dataType: 'json',
        type: 'POST',
        data: data,
        cache: false,
        success: function (result) {
            alert(result.Schedule.IsRecursive)
            if (result.Schedule.IsRecursive == false) {
                upcoming.destroy();
                recursive.destroy(); //Over here error
                RecursiveMeeting();
                UpcomingMeeting();
            }
            else {
                upcoming.destroy();
                 recursive.destroy();
                UpcomingMeeting();
                RecursiveMeeting();
            }
            $("#pageLoaderScheduleQuickMeeting").hide();
        },
        error: function (xhr, ajaxOptions, thrownError) {
            errorMsg("Something went Wrong. Please try again !");
        }
    });

I am geting
Uncaught TypeError: Cannot read property 'destroy' of undefined
at Object.success (AdminScript.js:431)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at y (jquery.min.js:4)
at XMLHttpRequest.c (jquery.min.js:4)

For recursive.destroy();
Whats the problem ??

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,482Questions: 1Answers: 10,467 Site admin
    Answer ✓

    The problem is basically what the error message says recursive is undefined.

    Either the variable is not scoped as you expected, or it hasn't be initialised yet.

    Allan

  • Abhi RAbhi R Posts: 17Questions: 5Answers: 0

    Thanks :smile: That problem is fixed :smile:

  • Abhi RAbhi R Posts: 17Questions: 5Answers: 0

    @allen Is there any example for infinite scroll.
    I mean on scroll load the data.

  • allanallan Posts: 63,482Questions: 1Answers: 10,467 Site admin

    Not one that I've published. But you could just listen for the scroll event and then use rows.add() to add newly loaded rows.

    Allan

This discussion has been closed.