-
- 16 Posts
Sorry if this is a silly question, but what is the index-ajax.php file for? If I try and run it in my browser I just get a blank screen.
It’s for including a custom ajax handler that can get access to the MODx database without loading the MODx code (other than the config file).
AJAX uses .php scripts external to MODx, so you can’t use the nice $modx->... features, such as database access functions. Including the index-ajax.php file lets you use the $modx objects in your external .php scripts.
-
- 786 Posts
If you want to see an example of how this is used, look at the files for AjaxSearch. It uses the index-ajax.php file to retrive the database info to create a db connection when the ajax funtionality is enabled.
-
- 90 Posts
can we remove this index-ajax.php file if we don’t use ajax or would it be taboo to do so
-
- 786 Posts
I’m not sure it would harm anything if you remove it, but it wouldn’t harm anything if you leave it also.
-
- 1,611 Posts
Personally I don’t usually upload it unless I’m going to use AjaxSearch with the Ajax features on, so no you don’t need it if you’re not using it.