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

  • SEARCH
  • Home
  • 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 8050813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:09:45+00:00 2026-06-05T07:09:45+00:00

Simply, users can login on my website. $(‘#login’).click(function() { var user = $(‘#username’).val(); var

  • 0

Simply, users can login on my website.

$('#login').click(function() {
    var user = $('#username').val();
    var pass = $('#password').val();
    $.ajax({
        type: "POST",
        url: "authorize.php",
        data: { username: user, password: pass },
        success: function(data) {
            $('#data').html(data);
        }
    });
});

The ajax success: will fire regardless of the login working or not, right? It does no server-side processing. How do I communicate to the Jquery script from authorize.php that the users login has failed?

  • 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-05T07:09:46+00:00Added an answer on June 5, 2026 at 7:09 am

    in your php do this:

    // your authentication magic here
    if($user->authenticated) {
        $return = array('status' => 'loggedIn');
    } else {
        $return = array('status' => 'failed');
    }
    echo json_encode($return);
    

    Then in your ajax call add the setting: dataType: 'json':

    $.ajax({
        type: "POST",
        url: "authorize.php",
        data: { username: user, password: pass },
        dataType: 'json', // NOTE this line
        success: function(data) {
            alert(data.status); // says 'loggedIn' or 'failed'
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple login form, username and password. Basically, When a user is
On my website users can keyword search and find desired results. (Just a simple
I store user editable articles in a database. Users can insert some simple widgets
I have a build a website where users need to login to, and the
I have a Silverlight 4.0 website where users can upload images. (Users have to
I'm trying to set up a simple Roles model for my site. Users can
Can someone please clarify using a SIMPLE user story the full slice of what
I have a simple form where a user can add, edit, and delete people
In a rather simple ASP.NET application where the user can upload a image, mostly
I'm creating a simple CMS using kohana3 in which user can add project to

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.