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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:47:47+00:00 2026-05-30T23:47:47+00:00

Trying to do a simple web app with jquery mobile. I have put together

  • 0

Trying to do a simple web app with jquery mobile. I have put together a simple log in form with ajax results to be displayed. Problem is my ajax is not getting a result even when I alert out to see if the URL is valid. Is there something special I need to do using jquery mobile?

Any thoughts/answers much appreciated!

Here is the HTML code:

    <div data-role="page" id="login" data-theme="a" data-add-back-btn="true">
        <div data-role="header">
            <h2>Log in</h2>
        </div>
            <div data-role="content" data-theme="a" data-add-back-btn="true">   
                <form action="mobilelogin.php" method="post">
                  Email: <input type="text" name="email" id="useremail">
                  Password:  <input type="password" name="password" id="userpassword">
                <input type="submit" value="Enter">
                </form>
                <div id="loginresult"></div>
            </div>
        <div data-role="footer"><h4>Chris Sherwood Design 2012</h4></div>
    </div>

Js file:

$(document).ready(function() {

  $('form').submit(function() {
  var emailchecker = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
  var email = $("#useremail").val();
  var userpassword = $("#userpassword").val();
  var checklength = userpassword.length;

  if(email == ""){
    alert('Please fill in email field');
     return false;
  }else if(userpassword == ""){
    alert('Please fill in password field');
     return false;
  }else if((!emailchecker.test(email))){
    alert('Please use a valid email');
     return false;  
  }else if(checklength < 6 || checklength > 6){
    alert('Password must be six characters');
     return false; 
  }else{
  var datastring = $(this).serialize();
  alert(datastring);
  return false;
        $.ajax({
        type: "POST",
        url: "mobilelogin.php",
        data: datastring,
        success: function(data){
        $("#loginresult").html(data);
        }
        });

  }

  });

PHP

<?php
echo 'nothing special here...';
?>
  • 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-30T23:47:49+00:00Added an answer on May 30, 2026 at 11:47 pm

    From your code:

    return false;
        $.ajax({
        type: "POST",
        url: "mobilelogin.php",
        data: datastring,
        success: function(data){
        $("#loginresult").html(data);
        }
        });
    

    You are returning false before the ajax request.

    EDIT (assumed it was a simple mistake, have added more explanation)

    You will need to either move that return false; to below the ajax() call, or use the event object like so:

    $('form').submit(function(e) {
        e.preventDefault();
    

    The problem with just using return false; is that if there is an error in something before it it will not stop the default action. So if your ajax request errors it will miss the return false; and start loading the action page.

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

Sidebar

Related Questions

I have a simple web mobile app that is calculating values in given fields.
I have a web app with a form that I am trying to pass
I'm trying to put together a small web app where users enter in the
I am trying to make a simple web app. I have a User table
I'm using Spring 3, and trying to set up a simple web-app using annotations
I'm trying to build a simple web app that calculates either a male or
I am trying to migrate a simple WinForms app to a ASP.Net web app.
I'm running a simple web app backed by node.js, and I'm trying to use
I'm trying run a simple Java/MySQL web app tutorial in NetBeans. I am able
I've been trying to get a simple hello world web app running on Sinatra.

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.