Server Release WebService, the box must have
Client code
<script type= "Text/javascript" > $ (document). Ready (function () {getwebservice (); SetInterval (Getwebservice, 1000); }); var Swic = true; var count = 1; function Getwebservice () {//Call no parameter method $.ajax ({type: "POST", Contenttyp E: "Application/json;charset=utf-8",//webservice will return the JSON type URL: "Http://localhost:3933/WebService/Interfac Eservice.asmx/helloworld ", Data:" {} ",//email parameter dataType: ' JSON ', success:f Unction (Result) {var text = "Get Request" +count+ "Times:" +result.d.tostring () + ""; $ ("#txtContent"). Text (text) if (SWIC) {$ ("#txtContent"). attr ("style", "Color:re D "); Swic = false; } else {$ ("#txtContent"). attr ("style", "Color:blue"); Swic =True } count++; }, Error:function (R, S, e) {debugger; callback handling when the request fails. Alert (e); } }); } </script>
<asp:content id= "bodycontent" runat= "Server" contentplaceholderid= "maincontent" >
Front page display
Regular polling request, the client uses Ajax to tune the WebService method