SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function(){
//your code goes here...
});
Bruce Ng's software development blog
An archive of solutions of programming problems I have faced in my career
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function(){
//your code goes here...
});