更新时间:2022-12-07 18:11:18
.ajax({
type: 获取,
url: Service.svc / GetName,
dataType: json ,
async: false ,
成功:功能(数据){
alert(' 你好,你好吗);
alert (数据);
},
错误: function (d,h){alert(d + h.responseText);}
});
.ajax({ type: "GET", url: "Service.svc/GetName", dataType: "json", async: false, success: function (data) { alert('hello how are you'); alert(data); }, error: function (d, h) { alert(d + h.responseText); } });
服务位于根目录。
服务定义: -
service is residing on root directory.
Service definition :-
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service" in code, svc and config file together.
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service : IService
{
public void DoWork()
{
}
public string GetName()
{
return "hello";
}
}