Redirect upon login

I have a bootstrap login popup. Upon login into the system throught the bootstrap popup I need to redirtect the client to either myAccount page or myCart page.

			message: 'This value is required',
			submitButton: '$login-form button[type="submit"]',
			live: 'enabled',
        	 feedbackIcons: {
	            valid: 'glyphicon glyphicon-ok',
	            invalid: 'glyphicon glyphicon-remove',
	            validating: 'glyphicon glyphicon-refresh'
	        fields: {

            username: {
            	group: 'col-sm-2',
                message: 'The username is not valid',
                validators: {
                    notEmpty: {
                        message: 'The username is required and can\'t be empty'
                    stringLength: {
                        min: 2,
                        max: 30,
                        message: 'The username must be more than 2 and less than 30 characters long'

            loginPassword: {
            	group: 'col-sm-2',
                validators: {
                    notEmpty: {
                        message: 'The password is required and can\'t be empty'
        }).on('', function(e) {
     // alert(100)
        // Prevent form submission
      // Get the form instance
      var $form = $(;
      // Get the BootstrapValidator instance
      var bv = $'bootstrapValidator');
      // Use Ajax to submit form data
          type: 'POST',
          url: '/includes/login.cfc?method=doLogin',
          data: $("#login-form").serialize()
        .done(function(result) {
          if (result == 'yes') {
           // alert('Valid');
			//= '#session.gotoPage#';	
          } else {
            //alert('Not Valid');
        .fail(function() {
        .always(function() {

Open in new window

LVL 19
erikTsomikSystem Architect, CF programmer Asked:
Who is Participating?
Gurpreet Singh RandhawaConnect With a Mentor Web DeveloperCommented:
correct where there is a cfc, he can write a function which can return multiple structs and one such can be to convert to json to know what is being returned and if that is cart is 1 , navigate to the cart else to the account section
Gurpreet Singh RandhawaWeb DeveloperCommented:
and what is the problem you are facing, not reloading or reloading or what?, any error you are getting
I think the author forgot to ask a question..
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

erikTsomikSystem Architect, CF programmer Author Commented:
Well the question is how to redirect in to a different url.   I need to redirect the client to either myAccount page or myCart page. If the client have something in the cart then redirect to the cart page other wise to my account page
Gurpreet Singh RandhawaWeb DeveloperCommented:
In your AJAX call return the json data and parse it and based upon write two different logics to navigate the user
gdemariaConnect With a Mentor Commented:
The question then is, how do you know if the cart has something in it or not?
You could build that into your CFC do Login script  and just return the URL of where the user should be redirected.

Then in jquery do a href location to that returned variable
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.