I use Ajax to transfer data and form files to a PHP file for processing.
Javascript
$("form#applyform").submit(function(){ var data = new FormData(); jQuery.each($('#file')[0].files, function(i, file) { data.append('file-'+i, file); }); $.ajax({ url: 'ValidateApplication.php', data: data, cache: false, contentType: false, processData: false, type: 'POST', success: function(data){ alert(data); } }); }
ValidateApplication.php definitely exists. I can view it if I type the address in a web browser, however, when I submit the form, the chrome console returns 404.
PHP is in the same folder as the HTML page that JavaScript is running on, so I'm confused about why I keep getting 404.
UPDATE
Changing POST in GET gets rid of 404 error, but returns 500 Internal Server Error
UPDATE 2
Changing the form's action to = "ValidateApplication.php" and submitting it as usual (without AJAX) results in the correct file without any errors.
source share