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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:28:43+00:00 2026-06-13T11:28:43+00:00

i have an issue with a form on a jquery mobile site with two

  • 0

i have an issue with a form on a jquery mobile site with two or more pages.

one page contains a form and when clicking the submit button of this form, i want to submit the form data and then stay right on this page. so i added the id of that page to the form’s action attribute. (<form action="#two">).

but unfortunately this doesn’t seem to work. when submitting the form data, always the first page of the actual file is loaded, even if the browser’s url seems right (the correct id was appended to it).

and it’s getting even worse. because i added the id to the form’s action attribute, jqm loads the first page of the file but apparently thinks to be on the second page, so the link pointing to the page with the form won’t work anymore.

one thing resolved this issue: adding data-ajax="false" to the form element forces jqm to stop ajax-based page handling for this form and when clicking the submit button i end up on the right page, but i do not want to reload the entire page so that’s no solution.

does anyone know what’s going on here and has encountered the same issue? feel free to try the appended example, i hope someone can solve this.

<!DOCTYPE html> 
<html> 
<head> 
    <title>My Page</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head> 
<body> 

<div data-role="page" id="one">

    <div data-role="header">
        <h1>First page</h1>
    </div><!-- /header -->

    <div data-role="content">   
        <p>Hello world</p>
        <p><a href="#two">Link to second page</a></p>   
    </div><!-- /content -->

</div><!-- /page -->


<div data-role="page" id="two">

    <div data-role="header">
        <h1>Second page</h1>
    </div><!-- /header -->

    <div data-role="content">   

        <form action="#two">
            <button type="submit">Submit</button>
        </form>

    </div><!-- /content -->

</div><!-- /page -->

</body>
</html>
  • 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-13T11:28:44+00:00Added an answer on June 13, 2026 at 11:28 am

    Change your input submit tag to call a function.

    <input type="submit" onclick="submitThis()" />
    

    Add this logic to your submit function which will call the submit url through ajax and return false to avoid physically submitting form.

    var submitThis = function() {
    
    // get form data using jQuery, and call the link using $.ajax()
    
    return false; // This will avoid submitting the page
    }
    

    –EDIT–
    Instead or returning false, you can also use preventDefault() method

            $("#submit").submit( function (e) {
                    e.preventDefault();
                   // do your task
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating one application with jquery.mobile-1.0a4.1 release. I have a page which is
I'm having an issue submitting a form with jQuery's submit() . I don't have
I have a little problem with javascript form submit issue, here is the script
I have a login form using jquery ajax and a php code. The issue
I am using jquery.mobile-1.1.0 for a PhoneGap application. I am getting issue in button
I googled for an issue in jQuery, and found patch file form jQuery site
I have a issue with Jquery Modal dialog being called from a button inside
I have run into an issue with JQuery form submissions and have found no
My issue involves jQuery .post and Joomla. I have a template with a form
I have issue with: <form:checkboxes path=roles cssClass=checkbox items=${roleSelections} /> If previous line is used

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.