Salt is NaCl which is Sodium Chloride separate that and you get sodium and chlorine gas.
Water is H20 which is Dihydrogen Monoxide (2 part hydrogen and one part oxygen) sepaprate that and you get hydrogen gas and oxygen gas.
Anyway, hydrogen gas and sodium are both positive ions (atoms), because opposites attract both of the positive ions are attracted to the negative electrode (cathode) in this case my cathode is a strip of magnesium. The chlorine gas and the oxygen gas are both negative ions and so they are attracted to the anode which in this case is iron. Now the chemical reaction REDOX which is short for reduction/oxidation reaction starts to take place. This means that the reductant (cathode) releases electrons (particles that are negatively charged) into the positive ions which make them negative and the oxidant (anode) soaks up the electrons from the negative ions leaving them positive again. But it doesn't stop there, the oxygen reacts with the iron creating iron oxide and the chlorine gas which was a negative ion gets its electrons which have a negative charge soaked up by the iron and so it is only left with its protons which are positively charged therefore it becomes a positive ion. As you all know positive ions are then attracted to the