function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dipu3dipu3 

XSS in JavaScript Remoting

How can we take care of XSS in JavaScript remoting?

Best Answer chosen by Admin (Salesforce Developers) 
dipu3dipu3

Oops! I did not pay attention to the escape parameter.

[.].([params...,] (result, event) {

    // callback function logic

}, {escape:true});

where namespace is your organization's namespace. This is only required if the class comes from an installed package. controller is the name of your Apex controller. method is the name of the Apex method you're calling. params is the comma-separated list of parameters that your method takes. callbackFunction is the name of the JavaScript function that will handle the response from the controller. callbackFunction receives the status of the method call and the result as parameters. escape specifies whether your Apex method's response should be escaped (by default, true) or not (false).