Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Any reason why you dont want to make a call through apex class? – Mohith Shrivastava Dec 24 '12 at 12:27
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 Dec 24 '12 at 14:01
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 Dec 24 '12 at 14:02

Sounds like you want to utilize the AJAX toolkit:

share|improve this answer

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", 
share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.