Yes, that general setup will work. You feed +5V into the anode side of the LED, and when you pull the cathode side down to 0V, the LED sees voltage across it, and the SSR is activated. But if there is no resistor in series with the LED, there is nothing to limit the LED current, and things can...