Render view as string when Ajax request to view is made
Posted
by mare
on Stack Overflow
See other posts from Stack Overflow
or by mare
Published on 2010-03-22T19:54:48Z
Indexed on
2010/03/22
20:01 UTC
Read the original article
Hit count: 155
jQuery
|asp.net-mvc
I have my views render to route requests like /controller/action (for instance, /Page/Create), so pretty classic.
I am creating a form where view will be loaded through AJAX request with jQuery get(), so essentially I need my Views or to be precise, my controller actions, to return plain HTML string when an AJAX request is made to the route that renders the View. I want to use the same views as for normal requests, so I cannot afford to create any new views.
It is something like calling RenderPartial("MyViewUserControl") but from inside the JS code.
© Stack Overflow or respective owner