Using Asp.Net 4.0 Web Forms and Jquery 1.6.2.
I want to make an Ajax call to a WebMethod on a page and have it return html.
On the server side the WebMethod looks like this.
[WebMethod]
public static string GetOrders()
{
return theMethodThatGeneratesHtml();
}
and here is the calling Ajax function.
function GetOrders()
{
$ .ajax({
type: 'POST',
contentType: "application/json",
url: "Orders.aspx/GetOrders",
data: "{}",
success: function (data) {
$ ('#content').html(data);
},
dataType: "text"
});
}
The data that is returned from the WebMethod is always wrapped up as a json object that start like this.
{"d":"\u003ctable\u003e\r\n ........
How can I get the WebMethod to just return HTML?