简体   繁体   中英

Error 500 when sending form with AJAX

I am making a website for someone where I need to send a form using AJAX, when I run the site on localhost there is no problem but on the online server I get a Error 500: Internal server error when I try to send the form. Does anybody knows the problem? The side is hosted by One.com

The AJAX code:

    $("#toevoegenAfb").click(function() {
    $.ajax({
        url: "add.php",
        type: "POST",
        data: $("#bestellen").serialize(),
        success: function() {
            alert("Gelukt");
        },
        error: function() {
            alert("Niet gelukt");
        }
    }
    );
});

The only thing I did on the add.php page was this:

<?php http_response_code(200);?>

To test if it would work, but it didn't. Anybody who can help me?

A 500 error can stem from the user and group that have access to the files. I'd check there to see what's up. Maybe the answer is as simple as chown-ing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM