I am trying to use jQuery .load() to get straight html from a asmx web service:
$('#target').load('MyService.asmx/GetHtml');
In .NET code, GetHtml() returns as string:
[WebMethod(EnableSession = false)]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Xml)]
public string GetHtml()
{
return "<span>Hi</span>";
}
That returns:
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">&lt;span&gt;Hi&lt;/span&gt;</string>
Notice that the string is encoded. With that encoding, $.load doesn't work right. The displayed text actually has the tags shown.
How can I get the WebMethod call to return just this?
<span>Hi</span>