I am using wrapper class to fetch the consumer object values and passed into Data table,

In that I am using consumer code and consumer name are the two text boxes.

Once I am enter the Consumer code, I need to make a Webservice call via javascript(not in apex code) and fetch the customer name from external webservice.

How to do that?

Plese share the sample code also if possible.

  • Any reason why you dont want to make a call through apex class? Commented Dec 24, 2012 at 12:27
  • 2
    If you're not using Apex, just do it the same way you would make any other webservice or ajax call from javascript -- it doesn't really matter that you're using Salesforce at that point.
    – Benj
    Commented Dec 24, 2012 at 14:01
  • 3
    Also, please include the relevant lines of your Visualforce page and/or html to help us understand your need and how we could help answer your question.
    – Benj
    Commented Dec 24, 2012 at 14:02

3 Answers 3


Sounds like you want to utilize the AJAX toolkit:



It could look like this, if your webservice method return a string:

<apex:includeScript value="/soap/ajax/20.0/connection.js" />
<apex:includeScript value="/soap/ajax/10.0/apex.js" />

var custName = "" + sforce.apex.execute("WebServiceClass","yourMethod", 

Hey You can use Javascript remoting to call a method in the controller, from the controller method call your webservice and return the desired value.

For more details on apex remoting please go through the following link http://www.salesforce.com/us/developer/docs/pages/Content/pages_js_remoting.htm

You must log in to answer this question.

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