dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: About popup login

  1. #1
    Join Date
    Oct 2012
    Location
    istanbul
    Posts
    64

    About popup login

    Login,

    This is popup login code and sends by GET method. I wonder, is it possible to send by POST method?


    Code:
    <html>
    <head>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript">
    function getXMLHTTP() {
        var xmlhttp=false;
        try{
            xmlhttp=new XMLHttpRequest();
        }
        catch(e){
            try{
                xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e1){
                    xmlhttp=false;
                }
            }
        }
        return xmlhttp;
    }
    function loginkontrol(){
        var kadi = document.getElementById("uname").value;
        var sifre = document.getElementById("password").value;
        var strURL = "loginkontrol.php?kadi=" + kadi + "&sifre=" + sifre;
        var req = getXMLHTTP();
        if (req) {
            req.onreadystatechange = function() {
                if (req.readyState == 4) {
                    // only if "OK"
                    if (req.status == 200) {
                        var sonuc = req.responseText;
                        alert(sonuc);
                    } else {
                        alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                    }
                }
            }
            req.open("GET", strURL, true);
            req.send(null);
        }
    }
    $(document).ready(function(){
        $("#login_appear").click(function(){
            $("#shadow").fadeIn("normal");
             $("#loginform").fadeIn("normal");
             $("#uname").focus();
        });
        $("#login_hide").click(function(){
            $("#loginform").fadeOut("normal");
            $("#shadow").fadeOut();
       });
       $("#login").click(function(){
            loginkontrol();
        });
    });
    </script>
    </head>
    <body>
    <div>
    <a id="login_appear" href="#">Login</a>
    </div>
    
        <div id="loginform" style="display:none">
    
            <form action="#">
                <label>User Name:</label>
                <input type="text" id="uname" class="input" />
                <label>Password:</label>
                <input type="password" id="password" class="input" />
                <br/>
                <input type="button" id="login" value="Login" />
                <input type="button" id="login_hide" value="Cancel" />
            </form>
        </div>
        <div id="shadow" class="popup"></div>  
    </body>
    </html>
    Best Regards

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,804
    You can do your AJAX stuff in JQuery if you are already using JQuery for other stuff.

    You should ask for help on that issue in the JQuery (frameworks) forum in the client-side development forum...
    STOP using $ prefix on JavaScript variable names...
    Please remember to wrap any code you have in forum tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles