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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.