Virtual switch

By searching that I found a Triac-output, 400V optoisolator. 6-pin DIP package at allelectronics: http://www.allelectronics.com/make-a-store/item/MOC3022/OPTO-ISOLATOR-TRIAC-OUTPUT/1.html

That will work right?

Datasheet here: MOC3022 Datasheet(PDF) - Texas Instruments