Function after function

Function after function

I have a simple line of  code 

  1. $('#main-menu').slideToggle(500)

What I want to do now is when that's finished sliding, run ajax, once that's done do something else.

I have do them all one by one but how can I do it so they work in order and wait for completion