Create a div in Ajax and then run a jQuery action
<p>I have a form that is meant to change the users email address, it works as when you click to confirm the new address i created code to open up a dialog box "on success". then this dialog box is a relogin box and i have an email and password field and button. When I click the button I set it so that console.log would echo "clicked", it doesnt do that. So is it actually possible to do what i need?</p>

<p>The update button </p>

<pre><code>$('input[name=updatedetails]').click(function(){
                var newEmailValue = $('input[name=newemailconfirm]').val();
                var accountID   =   $('input[name=userid]').val();              
                var dataString='email='+ newEmailValue +'&amp;userid='+accountID;
                $.ajax({
                        type:"POST",
                        url:"../assets/inc/user-change-email.php",
                        data:dataString,
                        dataType:'html',
                        context:document.body,
                        global:false,
                        async:false,
                        success:function(data){
                            console.log(data);
                            //document.location ="/";
                            var overlay = $("&lt;div/&gt;").addClass("overlay");
                            var logindialog = $("&lt;div/&gt;").addClass("popup-login");
                            $("body").append(overlay);
                            $("body").append(logindialog);
                            $(".popup-login").prepend('&lt;p&gt;&lt;label for="email"&gt;Email&lt;/label&gt;&lt;input type="text" name="email" id="email"&gt;&lt;/p&gt;&lt;p&gt;&lt;label for="password"&gt;Password&lt;/label&gt;&lt;input type="password" name="password" id="password"&gt;&lt;/p&gt;&lt;input type="button" name="relogindude" value="sign in"&gt;');
                            $(".overlay").fadeIn();
                            $(".popup-login").fadeIn();
                        }
                        });
                });             
</code></pre>

<p>The ReLogin Button</p>

<pre><code>$('input[name=relogindude]').click(function(){
                                console.log("clicked");
                                var email = $('input[name=email]').val();
                                var password    =   $('input[name=password]').val();                
                                var dataString='email='+ email +'&amp;password='+password;
                                console.log(dataString);
                                $.ajax({
                                        type:"POST",
                                        url:"../assets/inc/login.php",
                                        data:dataString,
                                        dataType:'html',
                                        context:document.body,
                                        global:false,
                                        async:false,
                                        success:function(data){
                                            window.location.reload();
                                        }
                                        });
                            });         
</code></pre>
