Jump to content

pretty big ajax file


ohdang888

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/248721-pretty-big-ajax-file/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.