jquery - Cross Domain Access of a asp.net webservice -
i have simple html page having this-:
$.getjson("http://www.bebas.co.in/myservice.asmx/functionname?callback=?", function(response) { //manipulate response }); /// and in myservice.cs file have this..
[webservice(namespace = "")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] // allow web service called script, using asp.net ajax, uncomment following line. [system.web.script.services.scriptservice] public class myservice : system.web.services.webservice { public myservice() { //uncomment following line if using designed components //initializecomponent(); } [webmethod] public string functionname() { //database access.. dictionary<string, object> result = new dictionary<string, object>(); result = jsonmethods.tojson(dsresult.tables[0]); //other operations... return new javascriptserializer().serialize(result); } }................. i want have cross domain access...but unable so..firebug gives me request format unrecognized url unexpectedly ending in...
what should do?.
you don't need web service return json. put code in normal webform (with no markup, blank .aspx), , call page_load() in code-behind (.aspx.cs).
or use httphandler.
Comments
Post a Comment