Heat the flat top griddle (or large cast iron skillet) on medium-high heat. Drizzle some oil and add the diced onions. Cook the onions until well caramelized, stirring every few minutes with a spatula.
Season the ground beef with salt & freshly ground pepper. Add a little more oil to the griddle and place each ball of ground beef on the surface. Flatten it into the griddle with the back of a spatula. Season the other side.
Flip the patties after a few minutes, then immediately add the cheese to start melting.
Spread a thin layer of mayo on the buns and smash them down into the griddle to toast.
Add caramelized onions to the top of each patty, then stack on the buns with more mayo or other sauces as desired.
Notes
If using cheddar cheese (or anything not American), I find it best for melting to grate the cheese instead of using slices.