Just in case! Possible duplicates:
PHP-Jquery-AJAX, show popup message
Form submission PHP ajax
Form submission PHP ajax
Show a success message after PHP form submission using AJAX
jquery popup after form submission
How to show a success message after PHP form submission?
PHP Ajax Form Submission
I am trying to show a "notification popup box" after successful form submission to DB.
I tested it with alert(); and its working fine, but the issue is the auto redirect.
HTML form:
<form action="form-process" id="reportsForm" method="POST"></form>
routes.php:
//Reports pages
get('/all-reports', '/pages/reports/all-reports.php');
get('/add-new-report', '/pages/reports/add-new-report.php');
//Reports form subbmision
post('/form-process', '/backend/form-process.php');
Ajax:
$(document).ready(function() {
    $("#reportsForm").submit(function() {
        var cccEmployee = $("#ccc_employee").val();
        var irNumber = $("#IR_number").val();
        var caseType = $("#case_type").val();
        var caseLocation = $("#caseLocation").val();
        var startDateTime = $("#startDate").val();
        var endDateTime = $("#endDate").val();
        var caseDesc = $("#case_description").val();
        var actionsTaken = $("#action_taken").val();
        var caseDetails = $("#details").val();
        var caseNotes = $("#notes").val();
        var caseRecommendation = $("#recommendation").val();
        $.ajax({
            type: "POST",
            url: "./backend/form-process.php",
            success: function() {
                alert("sucess");
            }
        });
    });
});
I tried to redirect using window.location & headers() then the code fails.
I am using PHP routing library and because of it somehow it's ruining my Ajax request?