<分区>
我已经创建了一个 c# web 服务,我正在尝试调用它并从 javascript 脚本中使用它,这是什么方法或最好的方法,在此先感谢。 我会解释更多: 这是网络服务:
public class DocumentInfo : System.Web.Services.WebService
{
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)]
public string GetDocumentInfo(string id)
{
Document document = new Document(Int32.Parse(id));
string output = JsonConvert.SerializeObject(document);
return output;
}
}
我已经测试过它,它有效,当我尝试建议的 ajax 解决方案时,我收到了这个错误 500 Internal Server Error。