0

I am using javascript remoting for a visualforce page to save some data, everything works as expected on desktop/pc (none of the errors below occured), but just not mobile device(using iphone 6 plus safari&chrome here ), it always gives this error below in the inspector console when page load initially:

[Error] Failed to load resource: the server responded with a status of 503 (Service Unavailable) (VFRemote.js.map, line 0)

when remote debugging on iphone using Safari web inspector,the error thrown as below. This was not happening when open page with any desktop browser though, only on mobile device

controller.upsertData(record,
 function(result, event) {
     if(!event.status)
     console.log(event.message);
 }
);

Visualforce Remoting Exception: Unable to connect to the server (communication failure). VFRREmote.js:2318

Any ideas/hints would be appreciated.

0

This code does not work for mobile. Not sure as of now. But you can try this approach.

   Visualforce.remoting.Manager.invokeAction(
                      '{!$RemoteAction.SiteDetailController.sendNotification}',
                      transId,
                      amount,
                      sendNotificationResult
                      );

         }
//here transid, amount is parameter and sendNotificationResult is method name which get called
  • thanks for trying to help, though the weird thing is I have two separate visualforce pages, the one above not working for mobile and another one works fine for mobile just using the same method format(Not Visualforce.remoting.Manager as well),another thing idk why is when on mobile it was always trying to locate file vfremote.js.map which for debug mode only as I know – red Feb 3 '16 at 6:54
0

The errors you're seeing in the console can be ignored, as they only appear during debugging. Salesforce Support have a knowledgeable article on this - https://help.salesforce.com/apex/HTViewSolution?id=000212395&language=en_US

I'd follow Tushar Sharma's Answer for alternative code syntax, it is the documented approach for JS remoting and seems to be much more consistent and reliable.

  • tried Visualforce.remoting.Manager did not work, still threw Visualforce Remoting Exception: Unable to connect to the server (communication failure), though Visualforce.remoting.Manager worked for desktop/pc as well – red Feb 3 '16 at 21:40
  • Is the method you're calling particularly complex? Could it be timing out for example? There are parameters you can pass to increase the timeout setting up to 120 secs - developer.salesforce.com/releases/release/related/…. Otherwise it sounds like a bug - has the environment been updated to the next release already? – Alex McDonald Feb 3 '16 at 21:56
  • i just figured it out , after hours and hours frustration, i was doing page re-direction right after remote action call(not in call back function), instead , the page re-direction must be included in remote action call back to make it work, other vf remoting will throw the error. Anyway ,thank you all – red Feb 3 '16 at 22:07
  • as for the reason i did page re-direction after remote action call(not in call back), i was thinking for remote actions are all async, so i don't have to wait and can do the page redirection immediately, looks like it will cause VFR error – red Feb 3 '16 at 22:17
  • Glad you worked it out! – Alex McDonald Feb 3 '16 at 22:30
0

i just figured it out , after hours and hours frustration, i was doing page re-direction right after remote action call(not in call back function), instead , the page re-direction must be included in remote action call back to make it work, other vf remoting will throw the error. Anyway ,thank you all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.