Capacitors are essentially two plates that are mounted next to each other, with a gap between them so that the plates don't touch. Direct current can't jump the gap between plates, because it would take a massive amount of voltage to force the electron to jump the gap between plates. The electrons hit the plate and stop. Alternating current, on the other hand, is moving the electrons back and forth in place -- so the plate on one side of the capacitor is constantly having electrons pushed in and then pulled back out. This motion creates a small electric field which induces the same alternating current in the other plate, because electric fields can jump the gap between plates. Therefore it is possible with ac supply only to make capcitor work.