Would anyone say that registering the path 'node/%/ajax' would be bad practise, potentially causing trouble for other modules that takes the easy path to implement AJAX functionality on node links?

I've got a node type which has a lot of AJAX functionality, and it would be an easy and obvious solution to simply handle AJAX callbacks via this link as Drupal does all the work for me on links such as 'node/19/nojs' where 'nojs' would be replaced by 'ajax'. Fallback to non-js browser would be taken care of by itself.

My concern is that it might be stupid to "occupy" this path for a single node type, and that it is a too obvious path to occupy with regards to other modules?

1 Answer 1


I wouldn't say it's bad practice as such, but I always go under the assumption it's good practice to prepend paths with your module name, e.g.


That way you can be pretty sure that you won't run into any issues with other modules that don't follow the same convention.

For the record I don't think I've ever come across a module that implements the node/%/ajax path, but if you're at the start of your implementation and can change the path easily, I'd go with adding your module name to it.

It'll mean some extra work on the JS side, but if you want to be as sure as possible that you won't get path conflicts in the future, I think it's your best bet.

  • 1
    The general rule is not causing conflicts with the module that uses a specific path for its menu callbacks; the Node module could use "node/%/ajax" as menu callback. Prefixing the path with the module name is the way to avoid conflicts.
    – apaderno
    Sep 5, 2012 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.