ASP.NET MVC with jQuery SimpleModal and Ajax.BeginForm Helper

I have a bit of a situation in which I am currently using jQuery SimpleModal to create various dialogs on my site, such as the login dialog.

I also use the Ajax.BeginForm helper.

Now everything works fine, and everything except what I need to know is what I need to do to say close the modality when the user was successful at logging in.

I tried several things, for example, setting the tempdata value, etc., and then checking this to close modal via jquery or just doing window.location to do the redirection ... which then the modal will disappear.

If I just do a redirectoAction, it fills the redirected contents of the action inside the modal in this case - this is any URL from which they return.

Thanks for the help .. greatly fixed.

Update: . I received it so that it closes the modal process when it was successful, however, what is happening now is when the user either simply contacts submit without entering anything, the client-side check is not and the user is redirected to the view that makes up this modal, but without the modal .. so basically it's just a presentation without the rest of the site.

Any ideas on how to keep them at this modal level until the correct information is entered?

+3
2

, JQuery.

, , , - OnSuccess AjaxForm.

<% using(Ajax.BeginForm("UpdateForm", 
         new AjaxOptions{OnSuccess="CloseModal()"})) { %>

,

function CloseModal() { $.modal.close(); }

, .

+2

?

, iframe, do

$('#modal',top.document).remove()
+1

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


All Articles