Wired up ajax functionality