我是ASP.NET新手,正在与我们的一个inhouse开发人员合作,但他们现在出来了,我有一个webservice可以使用,但我是让我还没有看到结果之前:Odd <string></string> .NET webservice为ajax调用返回的响应
数据回来是这样的:
<string xmlns="https://domain.com">
"<option>asdas</option><option>asdas</option><option>asdas</option>
<option>asdas</option><option>asdas</option><option>asdas</option>"
</string>
我有机会到.NET,以及和我看到以下内容:
[WebMethod(true)]
public string GetProductTypesByProductLine(string productLine, int cono)
{
var results = service.GetProductTypes(productLine, cono);
StringBuilder sb = new StringBuilder(1000);
foreach (var result in results)
{
sb.Append(string.Format("<option value='{0}'>{1}</option>", result, result));
}
return sb.ToString();
}
有人能指引我走向正确的方向吗?我只是期待一个简单的HTML输出,所以我可以利用,如果到一个jQuery的HTML Ajax调用。
但我不期待** JSON **,我期待只是纯文本/ HTML。 – Jakub 2012-03-13 18:50:59
@Jakub阅读DaveB的回答。您正在使用Web服务,期望获得XML或JSON。也许你根本不应该使用Web服务,但正如DaveB所建议的那样,使用HTTPHandler。 – Icarus 2012-03-13 19:08:48