Get JSON via javascript cross-domain aspx webMethod -
please me solve following.
there client side code json data server:
<input type="button" id="btn" value="btn" /> <script type="text/javascript"> $('#btn').click(function () { $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", data: "{'em':'1'}", url: "http://myserver/default.aspx/getinfo", datatype: "json", success: function (result) { $.each(result, function (i, field) { alert(field); }); } }); }); </script>
and there aspx page on server code:
[system.web.services.webmethod] public static string getinfo(string em) { return "{\"a\":\"" + em + "\"}"; }
the task create web method on aspx page placed on server client json data him. when test locally works when call web method server doesn't. know should change client code work cross-domains how should when have web method on server side?
Comments
Post a Comment