ohdang888 Posted October 9, 2011 Share Posted October 9, 2011 just wanted to get your thoughts on my ajax setup. I have 20+ ajax calls that all lead to the same ajax file, defined by action... like: myAjax.php?action=delete myAjax.php?action=save The way the actions are decided upon is through one really big SWITCH statement with 20 cases. The file is now about 80kB. Performance is not a problem now, but theres not many users. Could that potentially become a big latency problem down the line, the fact that the file is 80kB (and thus the parser must run through all that code... a lot of it is raw html though)... thoughts? thanks Quote Link to comment https://forums.phpfreaks.com/topic/248721-pretty-big-ajax-file/ Share on other sites More sharing options...
KevinM1 Posted October 9, 2011 Share Posted October 9, 2011 Why not break your commands into external modules and have your switch load and access the correct one? Also, are you minifying your JS? Quote Link to comment https://forums.phpfreaks.com/topic/248721-pretty-big-ajax-file/#findComment-1277346 Share on other sites More sharing options...
ohdang888 Posted October 9, 2011 Author Share Posted October 9, 2011 Why not break your commands into external modules and have your switch load and access the correct one? Also, are you minifying your JS? with require() ? ya, that's a good idea... at least for the few cases that are 100+ lines long. I haven't minified my JS yet. I don't plan on really taking the time to do while i'm in the building phase of the product Thanks Quote Link to comment https://forums.phpfreaks.com/topic/248721-pretty-big-ajax-file/#findComment-1277349 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.