+ Start a Discussion
Ranu JainRanu Jain 

Webservice call from Home Page Component

Hii ,

 

I am not much familier with web services . Cam any one help me what wrong in below code -

 

1. Its a home page component  - Remove Save and New

<div id="save_component">
&nbsp; <script src="/soap/ajax/11.0/connection.js" type="text/javascript"> 
 <script src="/soap/ajax/10.0/apex.js" type="text/javascript">     
 <script>  
   var result ;
   function addLoadEvent(func) {  
     var oldonload = window.onload;   
     if (typeof window.onload != 'function') {    
  	   window.onload = func;                           
      }          
	  else {
  	    window.onload = function() 
		{                                                               
		  if (oldonload) {   
		    oldonload();   
		  }                                               
		  func();                                       
	   }                     
	 }         
	}        
	addLoadEvent(function() {
 	 result = sforce.apex.execute("test_ranu1","createLinkSimple",'ranu');
	alert(result);    
	})    </script>&nbsp; </div>

 2.  its the class which have webservice method

 

global  class test_ranu1 {
public string flag{get;set;}
public test_ranu1 () {
  flag  = UserInfo.getProfileId();

}

webservice static string createLinkSimple(string url)
    {
          string returnVar = url;
             
           return returnVar;
    }

}

 

I am not getting alert message.

 

 

Thanks

Ranu