if you are doing intense cardio you don't want to eat within 2 hours or your meal will be going out either the front end or back end
if it is a normal weight lifting session you can eat something light like a couple eggs and fruit within that 2 hours.
no matter what you want to make sure you evacuate your bowels and urinate before any workout, that will make a huge difference and you never want to eat a sloppy meal, it will drag you down as your body must work to digest it while you workout