c# - how to consuming web service using jquery ajax in asp.net web application -
i unable consuming web service using jquery ajax possible using c# language. jquery ajax code`
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="jquery-3.0.0.js"></script> <script> $(document).ready(function(){ var url = "http://192.xxxx.xx.xx:10000/service1.asmx/getjsondata"; $.ajax({ type: "get", url: url, contenttype: "application/json; charset=utf-8", datatype: "json", success: function (data) { alert("hii"); alert(data.d) }, error: function (xmlhttprequest, textstatus, errorthrown) { alert("error"); } }); }) </script> </head> <body> <form id="form1" runat="server"> <div> </div> </form> </body> </html> above code not working when trying same using c# language working fine.
error is:network error:the acess denied in ie browser.
and error in google chrome following. xmlhttprequest cannot load http://192.xxxx.xx.xx:10000/service1.asmx/getjsondata.no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:49951' therefore not allowed access.
`
aparently ajax issue, not related c#. take here: "no 'access-control-allow-origin' header present on requested resource"
Comments
Post a Comment