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
Shruti NigamShruti Nigam 

how to stop execution in Visualforce.remoting.Manager.invokeAction

Hi all,

I want to stop execution in Visualforce.remoting.Manager.invokeAction after displaying alert.

Below is my code
Visualforce.remoting.Manager.invokeAction(
                            '{!$RemoteAction.demotest.checkdata}',test,d1,d2,function(result, event)
                  {
                      debugger;
                      if (event.status == true) 
                          {
                              
                          		if(result == null || result == " " || result == "")
                                    {
                                    		alert('No record found');
			                       // I want to stop execution here.
                                    }
                              
                          }
                      
                      else 
                      {
                      
                      }},
                 {escape:true});

Thanks in advance
Ajay K DubediAjay K Dubedi
Hi Shruti,

Use below code it may helpful for you: 
 
Visualforce.remoting.Manager.invokeAction(
        '{!$RemoteAction.demotest.checkdata}',test,d1,d2,function(result, event)
{
  debugger;
    if (event.status == true) {          
        if(result == null || result == " " || result == ""){
            alert('No record found');
            {escape:true}
        }                                  
    } else {
  
  }},
{escape:true});
            
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi