【发布时间】:2014-11-19 05:31:38
【问题描述】:
我正在尝试在纯 html 页面中调用 asmx Web 服务。但没有得到输出。我没有得到确切的问题。这是我为调用 asmx Web 服务而编写的 ajax 代码。
function Getdet(Name)
{
alert('hellotest');
$.ajax({
type: "POST",
url: "http://192.168.1.20/myservice/service.asmx?HelloWorld", // add web service Name and web service Method Name
data: "{''}", //web Service method Parameter Name and ,user Input value which in Name Variable.
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response)
{
alert('abcd1');
$("#spnGetdet").html(response.d); //getting the Response from JSON
},
failure: function (msg)
{
alert(msg);
}
});
}
我是否必须在代码中添加任何内容..??请让我知道我在上面的代码中哪里出错了。
【问题讨论】:
-
网络服务托管在哪里?它与您的 html 是否在同一个域中?
标签: html asp.net ajax web-services asmx