Deputies posted dashcam footage of the incident at Hammonton Township last week that shows Troopers Jacob Sherry and Steven Hodge breaking the windows of a car, and carrying the boy and dog to safety.

They had apparently been locked inside the car for 30 minutes before their rescue, as temperatures in the area reached 84 degrees.

“It’s a good reminder to parents and caretakers everywhere to be aware when securing children and animals and that you secure your keys,” Trooper Lawrence Peele of the New Jersey State Police told InsideEdition.com.

Deputies said the woman had finished loading her grandson and dog in the backseat of her car when she went to get into the driver’s seat, and realized she had left the keys in the passenger seat, locking her out of the car.