views:

334

answers:

1

Hi all,

I'm using Visual Studio 2008 and ASP.NET MVC 1.

I have a View where i open another View in a modal popup using fancybox. In this popup users can edit some data. It works great and the data is presented by the modalpopup, but when i click on the save button, the parent window changes to the modal popup content.

<script type="text/javascript">
        $(document).ready(function() {
            $("a#iframe").fancybox({
                'hideOnContentClick': false,
                'zoomSpeedIn': 300,
                'zoomSpeedOut': 300,
                'frameWidth': 640,
                'callbackOnClose': function() { location.refresh(); }
            });
        });
    </script>

and the link looks like this

<a href="/Client/Edit/idOfClient" id="iframe">Edit</a>

What can I do, that the response after clickin the save button remains in the modal popup.

Thanks in advance

A: 

I'm not clear if this is the solution you're looking for. With this function, send data via GET in "response" parameter,

'callbackOnClose': function(response) { 

  var getparm = "?";

  //if what it returns is an array
  if ($.isArray(response))
     response = $(response).toJSON();

  if (window.location.href.indexOf("?")!=-1)
    getparm = "&"

  window.location = window.location.href + getparm + "response=" + response;
}

Array to JSON

andres descalzo