A dog may be experiencing diarrhea due to a variety of reasons, including food poisoning, parasites, or a virus. If the dog is throwing up white foam, it may be a sign that he is experiencing pain or discomfort from the diarrhea. If the dog is shaking, it may be a sign that he is having a seizure.