Javascript salesforce中的远程操作不适用于safari,但适用于所有其他浏览器
无法从javascript调用控制器中的远程方法 JavaScript中的代码:Javascript salesforce中的远程操作不适用于safari,但适用于所有其他浏览器,javascript,salesforce,Javascript,Salesforce,无法从javascript调用控制器中的远程方法 JavaScript中的代码: Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.FitAssistenceController.updateObesityGoal}',
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.FitAssistenceController.updateObesityGoal}',
WeightValue,CaloriesValue,pastGoalRecommendedSteps,walkingSpeed,
function(result, event) {
console.log("event",event);
console.log("result",result);
}
);
@RemoteAction
global static void updateObesityGoal(String weightGoal,String calChange,String RecommendedSteps,String walkingType){
/* perform the action */
}
远程方法:
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.FitAssistenceController.updateObesityGoal}',
WeightValue,CaloriesValue,pastGoalRecommendedSteps,walkingSpeed,
function(result, event) {
console.log("event",event);
console.log("result",result);
}
);
@RemoteAction
global static void updateObesityGoal(String weightGoal,String calChange,String RecommendedSteps,String walkingType){
/* perform the action */
}
这在除safari之外的所有浏览器中都能正常工作
客户端错误如下所示:
[Error] XMLHttpRequest cannot load https://fitblissdev17-dev-ed--c.na40.visual.force.com/apexremote due to access control checks.
request (VFRemote.js:42:137)
request (VFRemote.js:74:225)
doSend (VFRemote.js:96)
combineAndSend (VFRemote.js:96:100)
g (VFRemote.js:79:99)
[Error] Visualforce Remoting Exception: Unable to connect to the server (communication failure).
Object
Could not fetch properties. Object may no longer exist.
error (VFRemote.js:117:461)
(anonymous function) (VFRemote.js:134:160)
fire (VFRemote.js:52)
fireEvent (VFRemote.js:47:170)
onProviderData (VFRemote.js:86:195)
fire (VFRemote.js:52)
fireEvent (VFRemote.js:47:170)
onData (VFRemote.js:94:464)
handleFailure (VFRemote.js:75:380)
a (VFRemote.js:39:392)
(anonymous function) (VFRemote.js:40:309)
我猜你是在点击按钮时调用JavaScript函数 如果是这样,我会尝试使用一个真正的按钮:
<button type="button" onclick="remoteCall();">Click Me!</button>
点击我!
我正在尝试调用Apex控制器中使用Salesforce中的远程操作功能的方法,该方法在除safari之外的所有浏览器中都能正常工作。是什么触发对控制器的调用?这是一个按钮点击、文档准备就绪等问题吗?如果这个问题是特定于浏览器的,一些HTML会很有帮助。type=“button”
在所有WebKit浏览器中都是至关重要的,包括所有iOS浏览器(Safari、Chrome、Firefox for iOS等)和Mac上的Safari(可能也在PC上,尽管我没有测试它),请看这里: