@Darth_Vader that looks like a horrible implementation. You don't need to hard code any urls or setup any extra pages or anything on the backend, you just create a function that sets up a new WP_Query, attach it to the
wp_ajax_ hook and call that from your JS with the WP ajax url