Step 1: Communicating with a asp.net Web Service:
Retrieving data :
I checked out a few examples online and also experimented with the JQuery ajax API.
I wanted to use JSON as the encoding method so here is what configuration settings worked:
Important settings:
TYPE - Must always be POST if you are communicating with a web service.
URL - Must be the path to your web service followed by a forward slash and the method you are calling in your web service. In the above example I call a web service called serviceLDAP.asmx. Within the web service I call a method called ajaxLookUpCCID.
ContentType - In order to get a JSON encoded response you must specify application/json; otherwise you will receive an XML encoded response.
Below is the method that is called in the web service:
Below is the JSON encoded Response from the web service. To retrieve the value "hello" within my JQuery success function I do is alert(msg.d);
No comments:
Post a Comment