HEX
Server: Apache/2
System: Linux mail.lnwhostname.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: suanchonac (1128)
PHP: 7.4.25
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/suanchonac/domains/suanchon.ac.th/public_html/admission-2568-1/admin/user/js/script.js
// Add Record
function addRecord() {
    // get values
    var regisno = $("#regisno").val();
    var regispwd = $("#regispwd").val();
    var regisnaid = $("#regisnaid").val();

    // Add record
    $.post("ajax/addRecord.php", {
        regisno: regisno,
        regispwd: regispwd,
        regisnaid: regisnaid
    }, function (data, status) {
        // close the popup
        $("#add_new_record_modal").modal("hide");

        // read records again
        //readRecords();
        window.location="index.php?add=yes";

        // clear fields from the popup
        $("#regisno").val("");
        $("#regispwd").val("");
        $("#regisnaid").val("");
    });
}

// READ records ตอนนี้ไม่ได้ใช้งาน
function readRecords() {
    $.get("ajax/readRecords.php", {}, function (data, status) {
        $(".records_content").html(data);
    });
}


function DeleteUser(id) {
    var conf = confirm("Are you sure, do you really want to delete User?");
    if (conf == true) {
        $.post("ajax/deleteUser.php", {
                id: id
            },
            function (data, status) {
                // reload Users by using readRecords();
                //readRecords();
                window.location="index.php?delete=yes";
            }
        );
    }
}

function GetUserDetails(id) {
    // Add User ID to the hidden field for furture usage
    $("#hidden_user_id").val(id);
    $.post("ajax/readUserDetails.php", {
            id: id
        },
        function (data, status) {
            // PARSE json data
            var user = JSON.parse(data);
            // Assing existing values to the modal popup fields
            $("#update_regisno").val(user.RegisNO);
            $("#update_regispwd").val(user.RegisPWD);
            $("#update_regisnaid").val(user.RegisNaID);
        }
    );
    // Open modal popup
    $("#update_user_modal").modal("show");
}

function UpdateUserDetails() {
    // get values
    var regisno = $("#update_regisno").val();
    var regispwd = $("#update_regispwd").val();
    var regisnaid = $("#update_regisnaid").val();

    // get hidden field value
    var id = $("#hidden_user_id").val();

    // Update the details by requesting to the server using ajax
    $.post("ajax/updateUserDetails.php", {
            id: id,
            regisno: regisno,
            regispwd: regispwd,
            regisnaid: regisnaid
        },
        function (data, status) {
            // hide modal popup
            $("#update_user_modal").modal("hide");
            // reload Users by using readRecords();
            //readRecords();
            window.location="index.php?edite=yes";
        }
    );
}
function DestroySes(){
    window.location="index.php?destroysearch=yes";
}

$(document).ready(function () {
    // READ recods on page load
    //readRecords(); // calling function
});