how to consume wcf service hosted by windows service using java script

前端 未结 1 1840
太阳男子
太阳男子 2021-01-17 04:29

Hi i had a wcf service hosted using windows service and the hosting of service was successfully completed and now my requirment is to consume it in javascript and the servic

相关标签:
1条回答
  • 2021-01-17 05:15

    I had got the answer Here is the code written in javascript

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript">
            window.onload = invokeService();
            function invokeService() {
                $(document).ready(function () {
    
    
                    //   Additional way of calling WCF service using getJSON() JQuery method
                    $.getJSON("http://localhost/WcfJsonRestService/Albums/rjinfo", {},
                        function (data) {
                             alert("hello " + data);
    
                        });
                });
                }
    
    
        </script>
    
    0 讨论(0)
提交回复
热议问题