I wrote an AJAX request for uploading a file and add it's details to MySql database (by a form).
The code works great, but breaks when I add preventDefault() to the submit event (to not be directed to the external PHP file).
$("#upload-form").submit(function(event){
// TODO: check why breaks PHP code
// event.preventDefault();
The same structure works great with other AJAX requests on the same file (for example AJAX request for editing MySql database).
I know the AJAX request is submitted because a new folder is created on my server (as part of the PHP code) but the file isn't uploaded.
I will be happy for an answer for one of these questions:
- What preventDefault() doe's that can interfere otherwise working AJAX request?
- How can I debug the external PHP code? as I'm not directed to it (because of the preventDefault())?
If my question is not clear enough - please help me make it clearer.