I am getting 'unable to connect to server' error when using javascript remoting.
vf page :
function my_custom_object__c(){
this.name = 'test';
}
function save(){
var myCustomObject = new my_custom_object__c();
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.MyControllerNew.save}',
myCustomObject,false,
function(result, event){
if (event.status) {
alert('success');
} else if (event.type == 'exception') {
alert(event.message);
} else {
alert(event.message);
}
},
{escape: true}
);
}
//controller - MyControllerNew :
@RemoteAction
public static pageReference save(my_custom_object__c customObj,boolean boolVal ){
//code here
}
I got some reasons and workarounds when googling this error , but none of it worked : I am getting the error immediately after calling the js function save(),so I doubt its a problem with default 30 sec timeout.Also I am using the controller as a extension.
Please help..
savedata
instead ofsave