Skip to content
Advertisement

Ajax doesn’t get a success response back after file upload

I just started with Ajax and also tried to find a solution for this.

Here is the problem:

I upload a .csv to a server. This works just fine. But after the upload “success” in the ajax call won’t respond. Neither does complete or error. It shows nothing. Not even an empty alert. Just nothing. I also didn’t find anything in the logs.

When I click the upload button without chosing a file to upload I get a response from success…

Here is the code:

upload.php

JavaScript

upload.js

JavaScript

the form in index.php

JavaScript

In the end I want a json back with the content of the uploaded file. But right now there is zero output if the file is uploaded.

Thanks for any advice!

EDIT for Solution:

The problem was something way different. I had to format the output from csvToJson to UTF-8. After that I get a json as the respone.

Function for formatting to UTF-8 (got it from another post here)

JavaScript

Advertisement

Answer

Solution, but cannot mark it:

The problem was something way different. I had to format the output from csvToJson() in upload.php to UTF-8. After that I get a json as the respone.

Function for formatting to UTF-8 (got it from another post here)

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement