TL;DR
No, skip the laundry detergent. It's formulated to foam and cling to fabric, which is exactly wrong for a carpet extraction machine.
Running low on carpet cleaner solution and eyeing the laundry detergent under the sink is a common shortcut, the logic seems sound since both are meant to clean fabric. But carpet machines and washing machines rinse very differently.
A washing machine flushes detergent out with gallons of moving water across a full cycle. A carpet extractor pulls a much smaller amount of liquid back out of dense fibers, which changes what kind of formula actually works.
Why Laundry Detergent Foams Too Much
Laundry detergent is engineered to suds heavily and lift dirt suspended in a large volume of water. A carpet extraction machine works with far less water and a suction pass, so that same foaming action overwhelms the machine and doesn't get pulled back out effectively.
What Leftover Residue Does to Carpet
Detergent left behind in carpet fibers acts like a magnet for dirt and dust, since it stays slightly tacky as it dries. Carpet cleaned with the wrong solution can actually look dingy again within a week or two, faster than before it was cleaned.
What to Use Instead
Use the solution recommended by the carpet machine's manufacturer, or a carpet-safe cleaning concentrate labeled for extraction machines. These formulas are low-foam and designed to rinse out with the smaller water volume a carpet machine uses. A simple mix of about 1 tablespoon of dish soap per gallon of warm water can work in a pinch for spot cleaning, but check your machine's manual first, since some warn against dish soap too.
If You've Already Used Laundry Detergent
Run the machine again with plain water only, using the extraction setting, and go over the same area 2 to 3 times to pull out as much residue as possible. Let the carpet dry fully, 6 to 12 hours with good airflow, before walking on it, and vacuum thoroughly once dry to lift any remaining residue.
Laundry detergent's heavy foaming works against a carpet machine instead of with it. Stick to a carpet-rated formula, and if the wrong soap already went in, a plain-water rinse pass afterward limits the residue left behind.