Problems with ajax form inside jQuery UI popup in IE8

I experimented with jQuery UI and MVC3, and I came across the following problem:

I have a very simple page using AJAX

<%: Ajax.ActionLink("Edit", "Edit", new { id = 1 }, new AjaxOptions() { UpdateTargetId = "dialog", OnSuccess = "DisplayPopup" }, null)%>

<div id="dialog" title="Location">

</div>

This is the controller code:

    public ActionResult Edit(int id)
    {
        return PartialView();
    }

    [HttpPost]
    public ActionResult Edit()
    {
        return Content("Saved!");
    }

and partial view editing:

<b>whatever</b>

<% using (Ajax.BeginForm("Edit", "Home",
    new AjaxOptions()
    {
        UpdateTargetId = "editForm",
        HttpMethod = "POST"
    }))
{%>
<div id="editForm">
    <input type="submit" value="Save" />
</div>
    <% } %>

The above code works fine.

now i am adding jquery UI popup code:

<script type="text/javascript">
    function DisplayPopup() {
        $('#dialog').dialog('open');
    }

    $('#dialog').dialog({
        autoOpen: false,
        width: 600,
        modal: true,
        buttons: {
            "Close": function () {
                $(this).dialog("close");
            }
        }
    });
</script>

after that it works fine in Firefox and Chrome, whereas in IE8 I see the following problem:

  • click edit - makes an AJAX call for the Edit (int id) action and shows the type of editing inside the popup
  • click save - makes an AJAX Edit () call and displays the text "Saved!"
  • close popup
  • click edit - call AJAX for editing (int id) - again
  • hit save - , this time it does a FULL postback (only in IE)

any ideas?

Thank!

+3
2

, , , . , .

<script type="text/javascript">
    function DisplayPopup() {
        $('#dialog').dialog({
        autoOpen: true,
        width: 600,
        modal: true,
        buttons: {
            "Close": function () {
                $(this).dialog("close");
            }
        }, close: function() {
                $(this).dialog("destroy");

            }
    });
    }


</script>
0

: FF, IE8.

- .

IE @ViewBag.Message , ViewBag.Message = "Submitted " + DateTime.Now.ToLongTimeString(); Post.

IE8.

0

Source: https://habr.com/ru/post/1774784/


All Articles