Question

I am trying to set content of thickbox in jquery as I want to take content from server. I am using following code in clientside:

            function ShowEditForm(id) {
               $.ajax({
                 type: 'POST',
                 url: '@Url.Action("ActionMethod", "Controller")'                        
               }).done(function (html) {

                 //I am getting my html here
                 alert(html);

              });                
            }

How do I show it in my thickbox?

Thanks in advance...

Was it helpful?

Solution

Thickbox has a built in way to display content via AJAX. If you wanted to get your Url Action in there, you can do so like this.

<a href="@Url.Action("ActionMethod", "Controller")?height=200&width=300" title="My Ajax Content" class="thickbox">My link</a>

I looked through their source code and I'm not seeing any callback to easily insert the HTML response into the opened window.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top