I want to make an ajax call to server. I need to fetch the html of page say foo.aspx: Foo.aspx html:
<form>
<div>foo</div>
</form>
I am calling this page from remote page like:
$.ajax({
url: '/foo.aspx',
data: {},
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (response) {
}
});
I need the html of this page BUT my requirement is that the response from this page should be JSON format. ie.
{"myresponse": {
"id": "123",
"html":<HTML of foo.aspx>,
}}
I need the html as a json property because I need to set other properties too from foo.aspx code behind? How can I get response from aspx page in json format instead of plain html? What is the other approach to get HTML of remote page + other properties too in json format from server? Should I go for HTTPHandlers? If yes, how can I get the html of foo.aspx in that HTTPHandler?