Yet another programmer blogging about code

Posts Tagged ‘ajax’

Hack a WordPress plugin AJAX action

Monday, July 13th, 2015

Customising the AJAX output of WordPress plugins can often be a breeze, when the authors oblige other developers by peppering their code with action and filter hooks. But if they don’t, you can always fall back on hacking the plugin’s AJAX action.

sessionStorage with expiry time

Saturday, November 16th, 2013

Session storage is a very handy tool for caching content fragments retrieved via AJAX. Once we’ve pulled the content once, and stuffed it into session storage, we can access it again quickly without the overhead of a round trip to the server. But what if we want to limit the age of that content, so that it expires before it gets too stale?

Add custom JavaScript actions to WP e-Commerce cart updates, again

Saturday, September 14th, 2013

I previously wrote about adding your own custom JavaScript actions to the WP e-Commerce cart update event. Of course, things change, people change, hairstyles change, interest rates fluctuate, WP e-Commerce moves goalposts, so there is a new way to do this since version 3.8.11 came out.

WooCommerce add to cart with quantity and AJAX

Sunday, August 18th, 2013

WooCommerce is a great e-commerce plugin for WordPress. It has some very nice basic features, but it’s also easy to customise and extend. On single product pages, you can add to cart with a quantity other than just one, and on the purchase page you can add to cart via AJAX without leaving the page. Wouldn’t it be nice to add to cart with both quantity and AJAX?

Using jQuery’s ajaxSend event to change an AJAX request

Friday, March 1st, 2013

Customisation of web software sometimes requires that you get it to pass around some additional information whenever it makes a page request. Often, putting that information into a cookie isn’t appropriate, so you try to squeeze it into the page query parameters, or form post data through hidden fields. But what if the software makes AJAX requests from jQuery? Luckily, jQuery can help you intercept AJAX requests so that you can customise them too.

Integrating Classic ASP with WordPress using AJAX

Sunday, July 15th, 2012

I’ve built a few websites now in WordPress with some custom data that had to be integrated into Classic ASP websites. Here’s how I did this using AJAX from VBScript.

Populate form from database using AJAX and JSON

Saturday, July 14th, 2012

I just went searching for a nice, simple example of populating a form from a database, using AJAX and JSON. I hope it’s just that my Google juice is depleted after a hard week, but I couldn’t easily find one. So I wrote one.

Give your Events Manager events an Add to Calendar link

Friday, March 2nd, 2012

The Events Manager plugin for WordPress lets you record and display your upcoming events, and is highly extensible through hooks and templates. Here’s how to give your single event page an Add to Calendar link that lets your visitors copy your events into Microsoft Outlook, Thunderbird, and any other iCalendar compliant calendar.

Add custom JavaScript actions to wp-e-commerce cart updates

Wednesday, February 22nd, 2012

I just stared in horror wonder at the wp-e-commerce script that handles cart updates. Wow. Just… wow. Forget any thought of nicely hooking into that to add some extra client-side actions, it’s a mess and looks like it will probably get worse before it gets better. But fortunately, there is another way.

Autocomplete in WordPress plugin admin

Tuesday, April 19th, 2011

I just had to find a way to add autocomplete to an admin screen for a WordPress plugin I’m writing. Although a few pieces of jQuery UI are bundled into the WordPress distribution, that doesn’t include jQuery UI autocomplete. But on the way to investigating how to drop that into my plugin, I discovered that WordPress does bundle in a similar, simpler plugin called jquery.suggest.