“This time the Romans came prepared with flammable weapons and anti-elephant devices: these were ox-led chariots, equipped with long spikes to wound the elephants, pots of fire to scare them, and accompanying screening troops who would hurl javelins at the elephants to drive them away. A final charge of Greek elephants won the day again, but this time Pyrrhus had suffered very heavy casualties - a Pyrrhic victory.”
from the awesome article on War elephants.