Laptop charger problem plugs in but does not work

Hey guys,
I have a laptop charger problem.
Last week I bought a new battery to see if this will solve the problem, but it didn't. It will charge when the laptop is off but once it is on the desktop it ceases charging. Before this problem had occurred I was using the laptop for a good week and all of a sudden, this happened.
