Strange cflocation behavior: redirecting to a page but not updating the url

I have a basic login page in ColdFusion that allows a user to enter a username and password and log in. Upon successful login, the page is redirected to the home page using cflocation. However, while the page is redirected successfully to the main page, it still displays the URL of the address bar entry page. We have used cflocation many times in our web application, and I have never encountered this behavior before and cannot understand what might cause it.

The essence of the page code:

<cfparam name="invalidLogin" default="false">
<cfif cgi.REQUEST_METHOD EQ "POST" AND isDefined("form.email") AND isDefined("form.password") and len(trim(form.email)) and len(trim(form.password))>
    <!--- call the login method --->
    <cfinvoke component="login" method="userlogin" returnvariable="userData">
        <cfinvokeargument name="userName" value="#form.email#">
        <cfinvokeargument name="password" value="#form.password#">
    </cfinvoke>

    <cfif userData.isLoggedIn>
        <cflocation url="index.cfm" addtoken="no">
    </cfif>
    <cfset invalidLogin = true />
</cfif>

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Log In</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link href="css/jquery.mobile.structure-1.3.2.css" rel="stylesheet" type="text/css" />
        <link href="css/jquery.mobile-1.3.2.css" rel="stylesheet" type="text/css" />
        <link href="css/common.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
        <script type="text/javascript" src="js/jquery.mobile-1.3.2.js"></script>
        <script type="text/javascript" src="js/common.js"></script>
    </head>
    <body>
        <div data-role="page" class="bg-color">
            <div class="container">
                <div data-role="content">
                    <div class="article">
                        <div class="logoDiv">
                            <img src="img/companyLogo.png" />
                        </div>
                    </div>

                    <form action="" method="post" name="frmLogin" id="frmLogin" class="margin-top" data-transition="slide">
                        <div>
                            <input type="text" name="email" id="email" placeholder="Username">
                            <input type="password" name="password" id="password" placeholder="Password">
                        </div>
                        <cfif invalidLogin><div>Invalid Login</div></cfif>
                        <div>
                            <input type="submit" value="Log In" data-theme="b" />   
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </body>
</html>
+3
source share
1 answer

jQuery Mobile Ajax, Ajax Navigation HTTP.

data-ajax="false" form. Ajax Navigation .

, , Ajax , data-transition="slide" .

<form action="" data-ajax="false" method="post" name="frmLogin" id="frmLogin">
+2

All Articles