Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to solve this problem

    hi......i am facing problem in my this code......please can somebody solve it......here this ajax code is not working....please solve the problem



    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script language="javascript" type="text/javascript" >
    function FieldBlank()
    {
    if(document.getElementById('t1').value=="")
    {
    alert("Username is required");
    return false;
    }
    if(document.getElementById('t2').value=="")
    {
    alert("Password is required");
    return false;
    }

    }
    </script>
    <script type="text/javascript">
    function login()
    {
    var username= document.getElementById('t1').value;
    var pass =document.getElementById('t2').value;
    var url="password.php?userid="+username+"&pass="+pass;

    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    if(xmlhttp.responseText=="ok"){
    window.location="adminpanel.php?user="+username;
    }
    if(xmlhttp.responseText=="no"){
    document.getElementById('errormsg').innerHTML="Please check the username & password again!!!";
    setTimeout("document.getElementById('errormsg').style.display='none';",3000);
    document.getElementById('t2').value="";

    }
    }
    }
    xmlhttp.open("GET",url,true);
    xmlhttp.send();
    }
    </script>
    <style type="text/css">
    .box {
    background-attachment:initial;
    background-clip:initial;
    background-color:#F5F5F5;
    background-image:initial;
    background-origin:initial;
    border-bottom-color:#E5E5E5;
    border-bottom-style:solid;
    border-bottom-width:1px;
    border-left-color:#E5E5E5;
    border-left-style:solid;
    border-left-width:1px;
    border-right-color:#E5E5E5;
    border-right-style:solid;
    border-right-width:1px;
    border-top-color:#E5E5E5;
    border-top-style:solid;
    border-top-width:1px;
    margin-bottom:156px;
    margin-left:284px;
    margin-right:284px;
    margin-top:236px;
    padding-bottom:15px;
    padding-left:25px;
    padding-right:25px;
    padding-top:20px;

    }
    .link{
    background-color:red;
    background-image:-webkit-linear-gradient(top, red, red);
    border-bottom-color:red;
    border-bottom-style:solid;
    border-bottom-width:1px;
    border-left-color:red;
    border-left-style:solid;
    border-left-width:1px;
    border-right-color:red;
    border-right-style:solid;
    border-right-width:1px;
    border-top-color:red;
    border-top-style:solid;
    border-top-width:1px;
    color:#FFFFFF;
    text-shadow:rgba(0, 0, 0, 0.0976563) 0 1px;
    }
    </style>
    </head>

    <body>
    <div id="main" align="center" class="box">
    <form action="" method="post" name="faq" onsubmit="FieldBlank();" >
    <table width="234">
    <tr>
    <td height="49" colspan="3" align="center"><solid> ADMIN LOGIN</solid>&nbsp;</td>
    </tr>
    <tr>
    <td width="75">Username</td>
    <td width="146">
    <input type="text" name="userid" id="t1" />
    </td>
    <td width="1">&nbsp;</td>
    </tr>
    <tr>
    <td>Password</td>
    <td>
    <input type="password" name="pass" id="t2" />
    </td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td><input name='button' type='button' class="link" id='Submit' value='Submit' onclick="login();" /></td>
    <td><a href="changepassword.php">Change password</a></td>
    <td></td>
    </tr>

    <tr>
    <td height="23" colspan="3">&nbsp;</td>
    </tr>
    </table>
    </form>
    <div id="errormsg"></div>
    </div>

    </body>
    </html>

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,355
    Thanks
    11
    Thanked 558 Times in 551 Posts
    What is your problem? What is your question?

  • #3
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Access directly the page being called via AJaX using the URL parameters. Is the page erroring?

    ^_^
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".


  •  

    Posting Permissions

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