08 May 2013
Promises are starting to change the way we write asynchronous JavaScript. They allow us to write clearer, shorter callbacks and to separate application logic from DOM interaction.
jQuery’s implementation of the Promise pattern (introduced in version 1.5) centres around the Deferred object , the predominate use of which is to attach success and failure callbacks to Ajax requests.
More …
09 Apr 2013
I’ve been doing quite a bit with jQuery and Ajax as of late and have not only been impressed at the ease of implementation, but also the snappy and responsive feel that it brings to your web apps.
To demonstrate this I’m going to show you how to make a simple unit converter, which will allow you to convert units of digital storage without having to make a single page refresh.
More …
14 Mar 2013
Consider this scenario:
You have a form which submits to itself (e.g. a simple contact form). The first time it loads you don’t want to do anything other that render the form.
However, when a user hits Submit, you want to process whatever data you have received, then re-render the form, including (for example) error messages where appropriate.
More …
28 Feb 2013
A while back I had to make a navigation menu which played a sound when you moused over the various menu points.
The problem was, that this feature didn’t play nicely with touch devices, as they don’t really have a concept of hover.
What happened instead was that the sound would play when the user selected one of the menu points, but would get cut off as the new page loaded – eurgh!
More …
19 Feb 2013
Sliding panels are cool! jQuery is cool! Who doesn’t love sliding panels and jQuery??
This tutorial demonstrates how to build a menu, where the items respond to a user click by sliding a panel into view containing relevant content.
Here’s a demo of what we’ll end up with.
More …
23 Jan 2013
All too often of late, I have seen people having trouble trying to debug some JavaScript or other.
Some were stumped by the white screen of death which confronted them the minute their script failed silently, whilst others were trying to debug their program using an alert dialogue box (a truly tedious process).
Well, good news it at hand. There is another, more efficient way to do things – with the console.
More …
11 Jan 2013
Recently, I was trying to help someone build a simple contact form in PHP.
This person was running everything locally on a MAMP server (Macintosh, Apache, Mysql and PHP) and everything was going swimmingly until we ran into a strange issue: PHP’s header('Location: ...')
wasn’t working as expected. In fact, it wasn’t working at all.
This is how we solved the problem.
More …
23 Dec 2012
Recently, a client asked me to have their contact form display in a Lightbox (as opposed to on a separate page). I happily implemented this for them and the end result looked pretty snazzy, so I thought I’d write up how I did it.
More …
09 Dec 2012
Short for HyperText Transfer Protocol, HTTP is the underlying protocol of the World Wide Web. It is used when a browser requests a web page from a server and it is used when the server responds to the browser’s request. HTTP is also stateless, which means that once a server has sent a page to a browser, it forgets having done so straight away. This can be a problem, for example, if a user has identified themselves in order to access protected pages, or if a user wants to customize some aspect of a website, as the server simply cannot remember a thing about it!
More …
26 Nov 2012
Imagine you want a visitor counter on your homepage. Sure, there are plenty of free ones out there, but I’m never happy about embedding random third-party code in my website, and besides wouldn’t it be more fun to make your own?
Of course it would!
More …