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 6850589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:08:35+00:00 2026-05-27T01:08:35+00:00

I know this site isn’t asking for people to work on a specific code,

  • 0

I know this site isn’t asking for people to work on a specific code, but I’m having a real hard time looking for examples/tutorial on jquery mobile login. I’m not sure if I’m doing this right, but I’m trying to get a user to login based on mysql database (if user is in my database), but I’m trying to figure out what to write up when user logs in? How do i set up so it will redirect to home page?

PHP page

 if(isset($_POST['email']) && isset($_POST['pass'])){
    $email = mysql_real_escape_string($_POST['email']);
    $password = md5(mysql_real_escape_string($_POST['email']));

    $sql = mysql_query("SELECT password,email FROM users WHERE email = ".$email." AND password = ".$password." LIMIT 1");

}

index.html

   $('form#login').submit(function(){
      var email = $("form#login input.email").val();
      var pass = $("form#login input.pass").val();
           $.post("ajax/post_login.php", {email: email, pass: pass},
               function(data){
               alert("failed"); //if not logged in
               });
    });

I’m having trouble here?

Can someone help me out with jquery mobile?

I have different many <div data-role="page">(content here)</div> and I want to know how to access a certain page, when logged in? and if email/username fails, theres an error?

I appreciate your help! Thank you!

  • 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-05-27T01:08:36+00:00Added an answer on May 27, 2026 at 1:08 am

    I solved it by posting the login data to the server with custom AJAX and letting the server respond with a JSON object containing the data needed to take an appropriate action.

    The script looked something like this (uses jQuery):

    formHandling.formSubmit = function (event, form) {      
        $.post(form.attr("action"), form.serialize(), function (result) {           
            var response = result,
                redirectUrl;
    
            //Redirect is set, we prio this.
            if (response.Redirect) {
    
                redirectUrl = response.Redirect;
    
                //Default redirect can be overridden by querystring
                if (helpers.getParameterByName("redir") !== "") {
                    redirectUrl = helpers.getParameterByName("redir");
                }
    
                document.location.href = redirectUrl; //This will cause a "full page load", but is desired in order to clean out the "Logged out view" of the pages
            } else if (response.Result) { //If no redirect is set, display the result in the target
    
                var resultTargetId = form.attr("data-result-target-id");
                formHandling.displayResult(resultTargetId, response.Result); //Displays an error/success message in element with id = resultTargetId
            }
        });
    
        event.preventDefault();
    };
    

    And sample JSON data returned from server side:

    //Failed login
    {
        Redirect: null, 
        Result: {
            IsError: true,
            ErrorMessage: "Failed to login" 
        }
    }
    
    //Successful login
    {
        Redirect: "http://www.example.com/someloggedinpage",    
        Result: {
            IsError: false,
            ErrorMessage: ""    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey. I know this is not a 'refactor my code' site but I made
I know that I've seen this site before, but cannot remember it for the
I know this isn't strictly a programming question but y'all must have experienced this.
I know this isn't RESTful, but for now, I'm trying to set up an
I know this isn't a direct technical problem but this seems like an ideal
I know this isn't going to be secure. But, I'd like to at least
I know this isn't a straightforward question but I would really appreciate some feedback
Hi I know this question have been asked before but the answers there isn't
I know this question has been asked many times, but I am having trouble
I know this question isn't exactly a programming question, but it will affect how

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.