Apex Controller for Javascript Remoting Sample


/ Published in: Java
Save to your folder(s)

The matching visualforce page code can be found here : http://snipplr.com/view/51124/editable-account-grid-using-visualforce-javascript-remoting--jquery-templates/


Copy this code and paste it in your HTML
  1. public global with sharing class testremotingcontroller {
  2. @RemoteAction
  3. global static Account[] searchAccounts(String accountName) {
  4. // Search accounts for the account name passed from Javascript
  5. accountName = accountName.replaceAll('[*]', '%');
  6. return [select id, name, phone, type, numberofemployees from
  7. Account where name like :accountName ];
  8. }
  9.  
  10. @RemoteAction
  11. global static boolean updateAccount(String accountId, String phoneNum) {
  12. // update account for the accountId and phone-number passed from Javascript
  13. update new Account(Id = accountId, Phone = phoneNum);
  14. return true;
  15. }
  16. }

URL: http://snipplr.com/view/51124/editable-account-grid-using-visualforce-javascript-remoting--jquery-templates/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.