State laws differ however in most states that offer traffic school or a defensive driving course as a way to dismiss a ticket you must request this option from the court before you are convicted of the violation on the ticket.
Once you plead guilty or are otherwise convicted of the charge you usually cannot take a class to wipe it off of your record since this option needed to taken before the conviction went through and the offense was placed on your driving record.
There are states, such as Idaho and New York, that have defensive driving and driver improvement classes that will remove points from your driving record after you have already been convicted of a violation and it has been put on your driving record. In these states the conviction of the offense remains on your driving record but you can get points taken off.
To see what your specific state's laws are and if you have an option to take a defensive driving course after paying a ticket to remove the violation from your driving record contact the court that was listed on your citation and/or your local Department of Motor Vehicles.