CRM 2011 JS: Save and Close function for CRM 2011

//This is how to Save and Close function in javascript for CRM 2011

 

//Save function

Xrm.Page.data.entity.save();

 

//Save and Close function

Xrm.Page.data.entity.save("saveandclose");

 

//Save and New function

Xrm.Page.data.entity.save("saveandnew");

 

//Close function

Xrm.Page.ui.close();