jQuery, Is there a way to bind events reloading a script?


I have an ajax function that gets a table body from laravel and reloads it. Each row has a checkbox input which has events from a template script. Moreover this script changes the checkbox style. Everything works fine until I call this function. Then, the table reloads and the checkbox style and events stop working.

I don’t know how to solve this manually, so I tried to reload these scripts (with “jQuery.getScript()”) but it doesn’t work. Is there any way to reload an entire script? or do I have to bind the events with “on()”?


<?php $i=0; foreach($content as $file) : ?>
    <tr class="<?php if($i%2==0) echo 'even'; else echo 'odd'; ?> pointer">
        <td class="hidden-cell">{{ $file->id }}</td>
        <td style="width: 60%;">
            <span style="line-height: 20px;"><i class="{{ fileIcon($file->extension) }}"></i> {{ $file->name }}</span>
            <input type="text" class="hidden-cell edit-name" placeholder="{{ $file->name }}">
        <td style="text-align: center;">
            @if( $file->type == 'archive')
                {{ getSizeString($file->size) }}
        <td style="text-align: center;">{{ $file->extension }}</td>
        <td style="text-align: center;">{{ $file->created_at }}</td>
        <td class="a-center">
            <input type="checkbox" class="flat" name="table_records">
<?php $i++; endforeach; ?>


function loadFolder() {
        type: "GET",
        url: "/drive/load",
        data: { id_folder: clickedId },
        dataType: "html",
        success: function(response){
            $('.pointer').on('dblclick', dbclickFile);
        error: function(jqXHR, textStatus, errorThrown) {
            var newDoc = document.open("text/html", "replace");

Source: Stack Overflow


Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273