hit web service from javascript

Solutions on MaxInterview for hit web service from javascript by the best coders in the world

showing results for - "hit web service from javascript"
Angelo
26 May 2017
1Use jQuery for performing POST or GET request from your html page like this :
2
3function fun() 
4{
5   var data="hello";
6   $.get("http://localhost/ws/service.asmx/HelloWord", function(response) {
7        data = response;
8   }).error(function(){
9  alert("Sorry could not proceed");
10});
11
12   return data;
13}
14OR :
15
16function fun() 
17{
18  var data="hello";
19  $.post('http://localhost/ws/service.asmx/HelloWord',{},function(response) 
20  {     data = response;
21  }).error(function(){
22  alert("Sorry could not proceed");
23});
24
25    return data;
26}