[Solved] AJAX return error on request but the php function works

[ad_1]

My god that is a lot of nested ifs. Have you considered using something called exceptions to generate your errors?

I cannot check the return value of your PHP script. However, jQuery expects a json return (as you are setting the dataType to that) and will fail if it gets anything else…including an empty string.

8

[ad_2]

solved AJAX return error on request but the php function works