You can try drinking a large glass of water after exercize, but what works even better is a large glass of whole milk.
Not processed milk, like skim or 2%...drink only Whole milk.
There are enzymes and minerals in the butterfat of whole milk that prevent muscle spasms in young calves. They grow rapidly and their mommas milk helps to prevent muscle spasms in their legs. This also works for humans.
If you have switched from whole milk to skim milk to lose weight, that can be your problem. After a few weeks you can start to get muscle spasms, TMJ, and carpel tunnel and tarsel tunnel. You might have deprived your nerves of the trace minerals found in the butterfat of fresh whole milk that prevent muscle spasms.
If you have developed nerve damage from a deficiency of the trace minerals, you might have to drink a quart of whole milk every day for a few months to restore your nerves to a healthy state. It's best to cut calories by removing junk foods and pastries from the diet. Switching from whole milk to skim milks is not a good choice when it comes to your health.
Here is a study on Whole Milk:
J Am Diet Assoc. 1987 Aug;87(8):1036-42
Mineral content of market samples of fluid whole milk.
Pennington JA, Wilson DB, Young BE, Johnson RD, Vanderveen JE.
Results from the Food and Drug Administration's Total Diet Study on the nutrient element content of fluid whole cow's milk
are presented and compared with previously published values. Whole milk was collected and analyzed yearly from 1975 through 1985. Yearly and overall means were similar for all elements except iron and iodine.
The iron content of milk was generally low, but several samples had high levels. The distribution of iodine in whole milk was quite wide (0.002 to 0.094 mg/100 gm). The iodine content of milk is affected by the level of iodine added to cattle feed and by the use of iodophor sanitizing solutions used by the dairy industry.
Overall mean levels of the elements in milligrams per 100 gm whole milk were: sodium, 42; potassium, 134; calcium, 106; phosphorus, 83; magnesium, 9.8; iron, 0.07; zinc, 0.37; copper, 0.009; manganese, 0.004; iodine, 0.034; and selenium, 0.001.
Coefficients of variation were high (67% to 117%) for iron, copper, manganese, selenium, and iodine but ranged from 18% to 26% for the other elements.
An 8-fl oz serving of whole milk is an excellent source of iodine, calcium, phosphorus, and potassium. It also provides some sodium, magnesium, zinc, and selenium but is not a reliable source of iron, copper, or manganese.