Take the 2-minute tour ×
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.

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
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 Dec 24 '12 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 Dec 24 '12 at 14:02

3 Answers 3

Sounds like you want to utilize the AJAX toolkit:

http://www.salesforce.com/us/developer/docs/ajax/index.htm

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" />

<script>
var custName = "" + sforce.apex.execute("WebServiceClass","yourMethod", 
                                       {param1:"1234", 
                                        param2:"true"}); 
</script>
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 http://www.salesforce.com/us/developer/docs/pages/Content/pages_js_remoting.htm

share|improve this answer

Your Answer

 
discard

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.