asp.net - How to call .asmx web service hosted on Remote server from plain html using ajax -


i've created simple web service using asp.net , hosted on machine's iis server. trying call web service plain html page without using asp.net. problem not getting response. here code below :

<html xmlns="http://www.w3.org/1999/xhtml"> <head>     <title>calling classic web services jquery</title>     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>     <script type="text/javascript">       $(document).ready(function () {         $("a#sayhello").click(function (e) {           e.preventdefault();            $.ajax({             type: 'post',             data: '{firstname:10,lastname:15}',           //  url: 'service.asmx/sayhello',             url: 'http://192.168.1.20/myservice/service.asmx/sayhello',             contenttype: 'application/json; charset=utf-8',             datatype: 'json',              success: function(response) {                  alert(response.d); //getting response json              },             failure: function(msg) {                 alert(msg);             }           });         });       });         </script> </head> <body>   <input id="name" /><a id="sayhello" href="#">greetings!</a>   </body> </html> 

can please me going wrong in code..?? if run in asp.net environment, works perfectly. if host this, doesn't work. please me...!!

are sure web service responding in json format? answers in xml. <script> block should go in <body> , not in <head>.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -