hook_menu URL giving 404 error on running site randomly
Page arguments, if specified, should always be an array. If you do not want to pass any arguments to your callback you should either code an empty array or omit the parameter. From experience I am fairly confident that this is your problem. 

Also, the correct way to return a JSON response is to return NULL from your callback after printing the JSON, rather than exiting. This ensures that cleanup tasks can be run.

Your code does not comply with Drupal standards, and I would strongly advise you to follow them. It's a major part of learning to work with the framework. https://www.drupal.org/docs/develop/standards