I need your advice on a functionality I'm trying to implement.
I create a modal view in order to login my users.
When I click on connect button ("se connecter" in French), I call FOSUser login path in Ajax in order to verify if login/password is right :
$.ajax({
type: 'post',
data: inputs,
url: '{{ path("fos_user_security_check", {'username': '', 'password': ''}) }}',
success: function(data) {
If the login/password is right, in Ajax data, I get a html page content (from a RedirectResponse in FOSUser login handler), something like this :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
...
</head>
<body>
...
I need to display this content properly. I could do a :
document.write(data);
It works, but It creates a blank view, then display the content, this is not very good !
I could reload my login form :
$("#formLogin").submit();
But it submits the login form 2 times, so this is not really what I want !
I could reload page but it means I don't take care of my data return by the FOSUser login handler, and I don't want to, I override the onAuthenticationSuccess to not redirect user on some page when he is logging to.
I'm a bit lost here, I really want to do something nice, properly, smooth for user ! Even if it takes time. I have no idea what to do, maybe a fade effect to display new content ? animations ? etc.
I hope I'm clear in my explanations. TY