Try charging it when the laptop is turned off. Not hibernate or sleep but actually off.
If it will charge when off, but not when on, then I would say the charger is going bad and will need replacing.
However, if it won't charge even when off, then it is more likely it is the battery that needs replacing.