标签:
[System.Web.Script.Services.ScriptService] public class TestService : System.Web.Services.WebService { [WebMethod] public string Test(string inputStr) { ////HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*"); return "Hello :"+inputStr; } }
function doClick1() {
$.ajax({ type: "post", url: "http://xx.com/TestService.asmx/Test", dataType: ‘xml‘, data: { inputStr: ‘everyone‘ }, success: function (data) { alert(data); //xml对象 }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log(XMLHttpRequest); alert(‘error:‘ + errorThrown); } }); }
标签:
原文地址:http://www.cnblogs.com/xuejianxiyang/p/5369346.html