Before I start, I looked at all the recommended questions with similar titles, even this one jQuery Ajax returning 404 Error, but correct Response but that one happens to be a wordpress issue, and I'm not using wordpress so it's of no use.
This is basic stuff here, but yet I can't get it to comply.
javascript call
$.ajax({
type: 'POST',
url: '/commentCenter/index/comment-ajax',
dataType: "text",
data: formData,
success: function(result){
console.log(result);
}
});
controller/action
public function commentAjaxAction() {
$this->_helper->layout()->disableLayout();
$this->view->output = "testData";
}
commentAjax.phtml
<?php
header('HTTP/1.1 200 OK');
echo $this->output;
?>
So, I've been trying just about everything here. In the Chrome inspector, I can see the 404 status code, but I can also see the output of my view in the response. So, I know it works. I attempted to add the status code header to the view ( I also added it to the controller for s&g's but no dice yet. As I mentioned, I've seen other solutions for similar issues but they are all wordpress related. I know I'm over looking something.
Thanks in advance.