I FINALLY FIGURED OUT A USE FOR AJAX!!!!!!!!!!!!!!!!!!!!!!!!!!

Sorry for the over enthusiastic title, but I am freaking psyched. Beyond psyched. I feel like I’m somewhere between having found the cure for cancer and having found the answer to world peace.

AJAX. Asynchronous Javascript and XML. It’s a technology where using Javascript on a page, you can make asynchronous XML requests back to a script on a site and update the page you are on without having to reload the page. One of the most common uses out there for it is the “suggest a search” feature you see on a number of sites, including the search bar of IE7 and Firefox 2 along with Google’s site. I have been looking for a way to incorporate AJAX into something, anything, I’m working on as it seems like something fun I can play around with. My first thought was to work on an addition to Badger’s search bar but well… I’ll do it but it hardly seems fun to work on something that’s been done to death. Well damn.. what else is there? THAT’S what I’ve figured out.

When I am uploading the invoice for a week to insert inventory, I have to select the title/category these issues are going into. If it’s Batman #600, I have to stick it in the Batman (1940) title/category. I accomplish this with a simple drop down box. It works and works well. However my uploaded invoice appears as one huge editable form with our 100+ books on it simultaneously. Originally I would try and go through the entire invoice and create categories for all newly added titles not previously available on the site. What would frequently (re: always) happen is I would be 60 items down on the invoice and come across a book I missed. Oops. At that point I could either abandon the work on the previous 60 items, or I could stick the book in a placeholder section (usually ’68 heh) and fix it after I saved the upload. After a few weeks of this, I decided I had to come up with a better solution.

Version 2.0 of the invoice upload form simply added a text box. This text box was for generating a new category on the fly. I would enter in the coded new category information and the book would be automatically added to that category. This has worked well, except for a number of instances where multiple SKUs for a single new book might exist (most recently Hack/Slash #1). In this case, to properly create the book initially I would essentially create two categories identically. I then would have to go into the inventory system and move on book over to the same category and delete the duplicate. Still easier than before, but still not perfect.

Then it clicked, and by clicked I mean I honestly think there was a real lightbulb over my head that turned on. With AJAX, I can create new categories on the fly and actually have it update every drop down box on the page. When I come across a book that doesn’t exist, I just create a new category/title for it and say OK, and when I look at the list again the new category will be selectable on that book and every other book on the page. This will be one of the biggest time savers I’ll have done on the maintenance portion of the site.

The other one I can do, though a little more involved, is to dynamically save my progress on the invoice. It can take me up to 2-3 hours to get the invoice completed and uploaded. However that will require quite a bit of work and some new elements added to the database. So I figure I’ll start off small with this upgrade and upon its success move on to the bigger save feature.


Leave a Reply

Your email address will not be published. Required fields are marked *