{"id":100,"date":"2007-06-12T17:25:50","date_gmt":"2007-06-12T22:25:50","guid":{"rendered":"http:\/\/www.borgh.us\/2007\/06\/12\/i-finally-figured-out-a-use-for-ajax\/"},"modified":"2007-06-12T17:26:10","modified_gmt":"2007-06-12T22:26:10","slug":"i-finally-figured-out-a-use-for-ajax","status":"publish","type":"post","link":"https:\/\/www.borgh.us\/?p=100","title":{"rendered":"I FINALLY FIGURED OUT A USE FOR AJAX!!!!!!!!!!!!!!!!!!!!!!!!!!"},"content":{"rendered":"<p>Sorry for the over enthusiastic title, but I am freaking psyched. Beyond psyched. I feel like I&#8217;m somewhere between having found the cure for cancer and having found the answer to world peace.<\/p>\n<p>AJAX. Asynchronous Javascript and XML. It&#8217;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 &#8220;suggest a search&#8221; feature you see on a number of sites, including the search bar of IE7 and Firefox 2 along with Google&#8217;s site. I have been looking for a way to incorporate AJAX into something, anything, I&#8217;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&#8217;s search bar but well&#8230; I&#8217;ll do it but it hardly seems fun to work on something that&#8217;s been done to death. Well damn.. what else is there? THAT&#8217;S what I&#8217;ve figured out.<\/p>\n<p>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&#8217;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 <a href=\"http:\/\/www.badgercomics.com\/index.php\/cPath\/21_27_401\">&#8217;68<\/a> 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.<\/p>\n<p>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.<\/p>\n<p>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&#8217;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&#8217;ll have done on the maintenance portion of the site.<\/p>\n<p>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&#8217;ll start off small with this upgrade and upon its success move on to the bigger save feature.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sorry for the over enthusiastic title, but I am freaking psyched. Beyond psyched. I feel like I&#8217;m somewhere between having&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[14,5,19],"tags":[],"class_list":["post-100","post","type-post","status-publish","format-standard","hentry","category-business","category-geek-stuff","category-programming"],"_links":{"self":[{"href":"https:\/\/www.borgh.us\/index.php?rest_route=\/wp\/v2\/posts\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.borgh.us\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.borgh.us\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.borgh.us\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.borgh.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=100"}],"version-history":[{"count":0,"href":"https:\/\/www.borgh.us\/index.php?rest_route=\/wp\/v2\/posts\/100\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.borgh.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.borgh.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.borgh.us\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}