jimmyoneshot Posted December 11, 2011 Share Posted December 11, 2011 In my system I have a collection of php files which handle the requests from my ajax e.g. I have a function which lets users "subscribe" to another user's posts "userConnect()" and another function which lets a user uprate another user's post "uprate()" At the moment the uprate() function uses ajax to pass it's data to a file called "ajax_uprate.php" and the userConnect() function similarly passes it's data to a file called "ajax_userConnect.php". Would I be better to combine these files into one global ajax.php file or is it better to keep them seperate? Basically I am wondering because at the moment I have a tonne of ajax_XXX files for every single function, each containing a very small amount of code. My thinking was that the smaller these files are the faster these ajax processes would take place. Am I right in thinking this or not? Quote Link to comment https://forums.phpfreaks.com/topic/252961-question-about-ajax-php-files/ Share on other sites More sharing options...
dzelenika Posted December 12, 2011 Share Posted December 12, 2011 I think that you should do groupping similar ajax functions into libraries. Files are relatively small, and code isn't scattered into small pieces which are difficult to maintain. Quote Link to comment https://forums.phpfreaks.com/topic/252961-question-about-ajax-php-files/#findComment-1296976 Share on other sites More sharing options...
xyph Posted December 12, 2011 Share Posted December 12, 2011 If they're minor functions, I don't see a big issue in grouping similar functions to reduce clutter. Quote Link to comment https://forums.phpfreaks.com/topic/252961-question-about-ajax-php-files/#findComment-1296989 Share on other sites More sharing options...
jimmyoneshot Posted December 14, 2011 Author Share Posted December 14, 2011 Gotchya. I'll probably group the smaller ones then. Thanks for the advice guys Quote Link to comment https://forums.phpfreaks.com/topic/252961-question-about-ajax-php-files/#findComment-1297951 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.