Thursday, February 20, 2014

PASS OR SEND THE VALUE FROM HTML PAGE TO WEB SERVICE PAGE

Pass the value from html page to webservice page using javascript

Introduction
   
     Hi, today we going to learn how to pass the values from html page to web service page. This will be an important one to be learn for working on the web services related tasks or wit the api services.

Description

     A simple example will be provided here for the better understanding, to transfer the data of html controls follow the below steps.

Step 1:  Add the soapclient.js file in your project.

Step 2: Add the controls and values in web page, in my example I am adding one text area and one button, so that if I click the button the text area value to go to the web service and get the result back.






Step 3: No on the script page add the variables as shown in the below pic.










here, the go2service will work on the click event of button, the txtareavalue will have the textarea field Text values and the parameters will contains the parameters to be passed to  the webservice method.

servicefunction_callback will return the value received from the web service method.

And I am returning the value to the same text area field.

Step: 3 Add the function and parameter value must be same given in the script.



Here I have added simple method which will return the string value.


here is the example run video in gif format.



THANK YOU!

No comments:

Post a Comment