Hi Mallesh,
Definitely you can Update and Insert Account or any object Record using JavaScript Remoting.
check the below code:
//This is a javaScript Remoting function, you can use it to update/Insert Account
<script type="text/javascript">
function getRemoteAccount() {
var account = {!accRec}; //Initialize an account in your controller like, Account accRec{get;set;}
//Then set the values of this from your page
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.MyController.updateAccount}',
accRec,
function(result, event){
if (event.status) {
//Even account get updated, you will get the values in "result"
} else if (event.type === 'exception') {
document.getElementById("responseErrors").innerHTML = event.message;
} else {
document.getElementById("responseErrors").innerHTML = event.message;
}
},
{escape: true}
);
}
</script>
Apex:
In apex you can have this method.
@RemoteAction
Public Static void updateAccount(Account acc){
if(acc != null){
try{
update acc;
}catch(DMLException de){
System.debug('DML Exception');
}
}
}
Hope this will be helpful!!!
Thanks