Replacing 8kb of javascript for 36kb

Monday, December 17, 2007

A long time ago I came up with a solution to use inline editing with EE using some ajax magic. The problem with that solution though was that the page would refresh once you submit something to edit. I figured that there must be a more elegant solution, one that updated the edited information without a page refresh.

I decided to revisit this problem and rewrite the code using the jQuery javascript library and the jQuery form plugin. However, there is a lot more javascript involved. The jQuery file itself is 26kb (the packed version), the jQuery form plugin file is 6kb, and the custom code is 4kb, so the total amount of javascript I have to include on every page is 36kb. The original solution used only 8kb of javascript (although it did require me to edit the HTML to add the javascript call, whereas with jQuery I don’t have to).

Oh well. At least I got to learn how to use the jQuery library. And, since I am the only person who’s authorized to do any editing, I made it so the javascript files are only loaded when I’m logged in, so it doesn’t make any difference whatsoever to you the reader.

Comments & Trackbacks

Post a comment.

The trackback URL for this entry is:

Gravatar for Stanislav Majerski

1. Stanislav Majerski Slovak Republic said:

on Dec 18 2007 @ 09:49 AM

Great, I was just going to try out your inline editing that you have put up on the EE wiki. Will this version you just made be availible for download somewhere.

Thanks
Stan

Post a Comment

Commenting is not available in this weblog entry.

Live Preview

Avatar

Comment Author

Oct 13 2008 @ 12:31 AM