I have two files, one where the ajax code is located and another one where the php is. Can you call from the URL in ajax to the PHP code within the same file? Something like in html:
<?php $_SERVER['PHP_SELF']; ?>
but in ajax
$.ajax({
url:"codigo php en mismo archivo que codigo ajax" })