I am displaying multiple popups( Tool tips)  on different visualforce pages and each popup has close button. By clicking on close button i need to call controller and perform DML operation in multiple pages. 

I have tried calling controller with Remote action from JavaScript ( JavaScript uploaded in Static Resource) since it is very large lines of code. I am not same controller from JavaScript when user is different pages. Below is the code i have tried calling controller from JavaScript. I am getting method not defined error.

        function(result, event){
        flag = result;
        console.log('Log here===='+result);


​Anil Kumar 

  • 2
    You won't be able to achieve this with javascript remoting. Javascript remoting is only supposed call its only page's controller's action. Why do you want to call other's page's server method?
    – Lance Shi
    Commented Aug 4, 2016 at 5:52
  • I want to perform DML operation and update the database instead of writing multiple methods in multiple classes i would like to write one method for all the pages Remote Calls.
    – anil kumar
    Commented Aug 4, 2016 at 7:26
  • 1
    Exactly for that kind of scenarios, extensions has been invented. Make your all logic in all class, and define it as an extension to your pages
    – kurunve
    Commented Aug 4, 2016 at 8:11

3 Answers 3


You can use the Window Variable in your page and later read from there

In your visualforce page add this

        configSettings = {
            remoteActions: {
                updateHopscothc: '{!$RemoteAction.MSSPageController.updateHopscotch}'


In your static resource you will just call this like

    function(result, event){
    flag = result;
    console.log('Log here===='+result);

Had the same problem.

The problem is because you're uploading the javaScript file via static resource, but all {!####} expressions (in this case your method's name) are been compiled on page load and not in the static resource.

My solution:

Add the remote action name as a hidden input field on the page, like this:

<input id="remote_action" type="hidden" value="{!$RemoteAction.MSSPageController.updateHopscotch}"/>

And then fetch the value of the input by the Id and pass it to the remote manager.

Hope I've helped.


This should work:

MSSPageController.updateHopscotch( function(result, event){ alert(result); flag = result; console.log('Log here===='+result); } );

  • Excuse me for the formatting
    – Craig Lobo
    Commented Mar 24, 2020 at 12:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .