Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8724167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:46:21+00:00 2026-06-13T07:46:21+00:00

I create a function in CakePHP controller class to process AJAX request. But I

  • 0

I create a function in CakePHP controller class to process AJAX request. But I found different result when using CakePHP function and simple (Non-MVC) PHP code. My problem is when it goes to submit() process. When using CakePHP function it returns blank page.

Here is the AJAX request code that I use:

var userdata = {username : $("#UserUsername").val()};
        $.ajax({
            type:'POST',
            url: 'http://localhost/mycakephp/users/login',
            data: userdata,                     
            success: function(data){                                    
                if(data==0){
                    alert("empty");                 
                } else {
                    $("#UserLoginForm").submit();                       
                }
            }               
        });     

But when I pointed the url to external site like this:

url: ‘http://localhost/test/test.php’

Which test.php is a simple PHP code to handle request, submit process works fine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:46:22+00:00Added an answer on June 13, 2026 at 7:46 am

    According to your comment, if you use the SecurityComponent, you could disable POST validation on the login action. In your UsersController, add this:

    function beforeFilter()
    {
        parent :: beforeFilter();
    
        switch($this->request->params['action'])
        {
            case 'login':
                $this->Security->validatePost = false;
                $this->Security->csrfCheck    = false;
                break;
        }
    }
    

    But off course you loose the value added by the SecurityComponent on the login action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I already managed to create function which checks if user is using a trial/demo
It's possible to call C functions through CREATE FUNCTION but how can .NET functions
I am learning cakephp by myself. I tried to create a user controller with
I'm using CakePHP 2.0.5 (but this isn't necessarily a cakephp specific question). I have
I have the following form in cakephp: <div class=quickcontactDisplay> <?php echo $form->create('Enquiry',array('action'=>'add','class'=>'quickcontact')); echo $form->hidden('visitor_id',
I'm new to cakePHP.I just tried to create a simple form with a text
I am attempting to create a change password form in cakephp 2.0. I found
I've just been following the tutorial on the CakePHP website to create a simple
I'm working in a CakePHP Model class, writing a function that is supposed to
I'm building a prototype search application using CakePHP and I have a search controller

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.