Request with jquery and PHP running jquery function

Request with jquery and PHP running jquery function

Regards,

I'm adapting a system that uses pure javascript to switch to jquery (jquery-2.1.1.js). I'm having trouble when making a request. In making the request ($ .post () or $ .getJSON ()) to a PHP file for success. But if PHP file has an IF and it has another function or javascript jquery I get an error message.

Note: There are no errors in PHP and jquery function is included correctly.

Attached is a flowchart of the problem.

There is something to be done?

I wait anxiously for answers to all!