AJAX success response is not working but it’s saving my changes

I’m beginner in jQuery AJAX too, and I always tried with $.ajax, but I’m using just $.post to my requisitions now and they work well. The syntax is more simple and less risk to make a mistake.

Obviously, if I’m wrong in this way, please someone alert me about it.

In $.post() you need to put the url, the variable would get by POST as object and a handler function(data,status). Just it.

In PHP code I just echo what I want to return to my page, and I’ve gotten an enconde issues once or twice, I solve the enconde issues in the JS, not in PHP.

Sometimes, I return numbers from PHP echo, and I use switch statement in JS to make what I want depending of the returned number, it solves some problems too.

I know I didn’t solve your problem, instead I’m trying to get alternative ways, but lemme known if it helps