Calling apex function

hii guys i tried to do that opportunity example i paste the code in snippet and in a button i select snippet name but its not working for me means that on click event nothing happens what wrong did i do can anyone tell me