I have some ajax here:
$.ajax({
type: "POST",
url: "<?=site_url('front_office/get_email_list/')?>",
dataType: "text",
success: function(response) {
console.log(response)
}
});
For some reason, this code returns the desired PHP but it also returns my head.php file.
function get_email_list() {
$center_ids = array(
/* list of user ids */
);
print_r(json_encode($this->user_model->get_email_list($center_ids)));
/* get_email_list($center_ids)) returns a database query result */
}
And finally, my head.php contains your usual <head>
tags with javascript and css imports.
Output looks something like:
**** return from php *****<head>header stuff</head>
I'd rather not parse out the header information but instead just get the PHP output.
Note: I am using codeiginiter and I am calling a function within the front_office
controller.
Second note: I know I am not posting anything at the moment, but I will be soon. I tried GET
but the problem persists.