function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Newbie10Newbie10 

Best practice Javascript apex/Visualforce

I have a usecase which can be either achieved by

1)create a custom button

2)add javascript

3)call apex global webservice class [all apex function to be called from JS should be global webservice]which has the logic of updating database

OR

1)create a custombutton

2)add javascript

3)redirect to a VF page

4)VF extension controller handles logic

Which is a best way to do this?I went for second thinking,more webservices might not be a good thing.But does anyone know what should be the approach to be taken in such cases

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox
Webservices uses API calls, but Visualforce doesn't. It would therefore be advisable to use the VF page over a webservice call.