There are several different systems involved with charging a battery…
One of the primary systems is the ac adapter.
If the ac adapter fails, then the easiest solution is to replace the adapter. Universal adapters are a great option to replace a broken adapter.
Another system that is involved with charging the battery is the battery itself.
When the battery fails, it also needs to be replaced. Batteries generally last between 2-3 years before they start failing. DC Jacks are one of the last systems that are involved with charging. When a dc jack is loose or its wiggling out of place you need to get the jack resoldered and placed correctly back on the motherboard.