NewStats: 3,265,490 , 8,186,929 topics. Date: Sunday, 15 June 2025 at 09:40 AM 6o9i

6382y

Tutorial: How To Return Html In Json Response Using Asp.net And Jquery - Programming - Nairaland 55k44

Tutorial: How To Return Html In Json Response Using Asp.net And Jquery (6098 Views)

(4)

(1) (Reply)

Syma: 1:42am On Nov 01, 2010
I just blogged on how to write a generic jquery function to handle ajax request that return html in json response. It's a good trick that I believe will find its way in your code library.

What I blogged about in this post is how to return html content in json response type. The useful thing about this technique is that you get to write your html once in a partial view, which you can then render using full page or ajax request, you can also use the same ajax request with different unrelated url that returned different types. This saves you from writing too many codes for different kind of request and reduces view duplication between server and client side.

The final result

[img]http://1.bp..com/_xtoz_qjBJqk/TM3Ohod-DqI/AAAAAAAAAA4/yylH_MZc1E0/s1600/return-html-as-json.jpg[/img]

You can read the blog and the source code here http://emekaemego..com/2010/11/how-to-return-html-in-json-response.html
Re: Tutorial: How To Return Html In Json Response Using Asp.net And Jquery by Nobody: 7:44am On Nov 01, 2010
Dude i really Like your articles as it ignites my interest in .NET,
Syma: 9:19pm On Nov 01, 2010
@pc guru
Thanks, I really want to be posting more frequently, but I'm finding it hard to squeeze our time.
I'm on new one now, will post it when am done.

(1) (Reply)

Mobile Phone Application Programming

(Go Up)

Sections: How To . 7
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or s on Nairaland.