I was playing with some ASP.NET PageMethods, and I tried to simply return XML using this:\[code\][WebMethod][ScriptMethod(ResponseFormat = ResponseFormat.Xml)]public static string GetIPLocation(string ip){ var doc = XDocument.Load(HttpContext.Current.Server.MapPath("relative xml path")); var s = doc.ToString(); return s;}\[/code\]The exact same code actually works with ASMX services, (removing the \[code\]static\[/code\] modifier though)But it turns out that I cannot get the XML when using PageMethods, instead, I'm receiving my page's HTML code.Here is my AJAX code:\[code\]$.ajax({ url: "<%: this.ResolveClientUrl("~/relative path/GetIPLocation") %>", type: "POST", contentType: "application/xml; charset=utf-8;", dataType: "xml", data: "{ip:'"+$target.val()+"'}", async: true, cache: false, success: function (msg) { console.log("MSG: %o", msg); viewModel.ip1(msg.d.IP); }, error: function (XHResponse, errorMessage, errorCode) { console.log("AJAX Error: %o", XHResponse); }});\[/code\]If I change the response to JSON or if I use an ASMX/WCF service instead of my PageMethod, it works like a charmSo are PageMethods incapable of returning XML by design??... If not what am I missing?Edit 1As commented by @JamieSee, I made this modification, still the same result:\[code\][WebMethod][ScriptMethod(ResponseFormat = ResponseFormat.Xml)]public static XDocument(GetIPLocation(string ip){ return XDocument.Load(HttpContext.Current.Server.MapPath("relative xml path"));}\[/code\]and\[code\][WebMethod][ScriptMethod(ResponseFormat = ResponseFormat.Xml)]public static XmlDocument(GetIPLocation(string ip){ var x = new XmlDocument(); x.LoadXml(HttpContext.Current.Server.MapPath("relative xml path")); return x;}\[/code\]