Jump to content

Ajax to module returns 404


Recommended Posts


I am trying to understand the structure for a module. Currently I have my module installed and displaying on the front end as expected and I am trying to AJAX the module to return information.


My module files looks like:

mydomain.com/modules/mymodule/mymodule.php (basic install, uninstall, hook)

mydomain.com/modules/mymodule/view/template/hook/mymodule.tpl (displays some js and a button)

mydomain.com/modules/mymodule/controller/front/ajax-call.php (echos a test string)


My javascript is:

<script type="text/javascript">
function testfunc(){
			url: '{$base_dir}modules/mymodule/ajax-call.php',
			type: 'get',
			data: 'ajax=true',
			success: function(data) {
    return false;


But it runs into a 404 response when the button is clicked.


I've also tried moving the ajax-call.php into the root of the module as the path would suggest but that also returns 404 so I am not sure why it is not hitting the page. Can anyone help?


Link to comment
Share on other sites

I have already tried that, I cannot reach anything with my module folder:


GET http://www.mydomain.info/modules/mymodule/controller/front/ajax-call.php?ajax=true/ 404 (Not Found) <- file DOES exist at that path

GET http://www.mydomain.info/modules/mymodule/ajax-call.php?ajax=true/ 404 (Not Found) <- file DOES exist at that path


My route to modules in Preferences -> SEO is the default: module/{module}{/:controller}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...