PageMethod返回完整的html页面

时间:2020-06-23 11:42:34

标签: javascript c# asp.net-ajax webmethod pagemethods

我有一个分页方法:

var test = "<?xml version='1.0'?><query><drawioIan>This is Ians XML</drawioIan></query>";
                PageMethods.GetDocument(encodeURI(test), onSuccess, onFailure);
                function onSuccess(result) {
                    debugger;
                    //XML returned, so need to drill into it.
                    alert(result.firstChild.childNodes[0].innerHTML);
                }
                function onFailure(error) {
                    debugger;
                    alert(error);
                }

可以调用一种网络方法:

[WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Xml, UseHttpGet = true, XmlSerializeString = true)]
    public static System.Xml.XmlDocument GetDocument(string svg)
    {
        string test = HttpUtility.UrlDecode(svg);
        //Response Is sent back as xml, you might be able to send back json instead - might be handier.
        System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
        xmlDoc.LoadXml("<root><item>Hello World</item></root>");
        return xmlDoc;
    }

网络方法未调用,但我收到状态码200 enter image description here

重新调整为整个html页面: enter image description here

也不会触发web方法上的断点。 有谁知道这个问题可能是什么?

编辑: WebMetho被跳过,但仍然返回onSuccess(): enter image description here

0 个答案:

没有答案
相关问题