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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:07:27+00:00 2026-05-31T13:07:27+00:00

I have a form like this <div data-role=page id=callAjaxPage> <div data-role=header> <h1>Login</h1> </div> <div

  • 0

I have a form like this

 <div data-role="page" id="callAjaxPage">    
    <div data-role="header">
        <h1>Login</h1>
    </div>

    <div data-role="content">
        <form id="callAjaxForm">
            <div data-role="fieldcontain">
                <label for="userName">Username</label>
                <input type="text" name="userName" id="userName" value=""  />

                <label for="password">Password</label>
                <input type="text" name="password" id="password" value=""  />

                <button data-theme="b" id="submit" type="submit">Submit</button>
            </div>
        </form>
    </div>
</div>

And in the $(document).ready () the code is

$(document).ready(function() {
    $("#submit").click(function(){

    alert("Hi");
    });
});

Then it works for the first time. But Second time my screen gets distorted.

If i put <form id="callAjaxForm" data-ajax="false"> then it is little bit better.
But still If i press submit it shows me an alert.And i have to wait a long time for the second alert..

Why is this happening?

  • 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-31T13:07:28+00:00Added an answer on May 31, 2026 at 1:07 pm

    Behavior you’re experiencing is correct for jQuery mobile.

    In jQuery mobile, there’s a concept of keeping user on the same page and rely heavily on ajax calls. That’s aimed to prevent reloading whole page and having to fetch again all the resources. Read this page, especially markup conventions section http://jquerymobile.com/test/docs/forms/docs-forms.html.

    Now that we have some background knowledge of how jQuery mobile works, we can take a swing on your problem.

    The reason why there’s no second alert message when you don’t put data-ajax="false" in your form is simply because the form you see after clicking #submit button for the first time isn’t the same form. It looks the same, it has the same markup, but that’s because jQuery mobile submits the form to the same address you’re on and displays the result. Click event handler you’ve attached on page load was valid at that time (meaning it still works but for that previous, now hidden button), so there’s no way you will see your alert message. Working example: http://jsfiddle.net/c4uy7/5/show/ notice the page transition that clearly shows how your initial form gets hidden (also notice the browser address bar – it stays the same).

    So that’s the first case. The behavior after adding data-ajax="false" to the form results in jQuery mobile to submit the form regular way, so the page actually get reloaded and the click handler for #submit button works every time. The long waiting time you mentioned may be caused by your network lag, slow server-side processing or something like that. Here’s example http://jsfiddle.net/c4uy7/4/show/ – clicking on submit shows alert every time (page gets reloaded as you can see by looking at the parameters in address bar).

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

Sidebar

Related Questions

I have a form, like this <form id=picuploadform enctype=multipart/form-data method=post action=> <div class=row> <label
Okay so say I have a form element like this: HTML: <div class=form-item> <label>Current
I have a form like the following. <div id=loginerr></div> <form action=?page=login method=POST id=loginForm> <table
I have form like this: <div class=satu> <input type='text' size='1' maxlength='1' name='score[1][]' id='score[1][]'> </div>
I have form like this : <div id='add_field' class='locbutton'><a href='#' title='Add'>Add</a></div> <div id='remove_field' class='locbutton2'><a
I have a form that looks kind of like this: <div> <div class=contact> <h1>Person's
I have form like this: <form method=POST action=<?php echo base_url() ?>admin/admin_search> <fieldset> <label for=nalozi>Nalozi</label><input
I have a form like this: <form action=form_send.php method=post> <table> <tr> <td><label for=address>address</label></td> <td><input
I have a form like this (from a widget template): '<div>' + ' <form
<form id=questions_1> <div data-role=collapsible-set data-theme= data-content-theme= id='q1'> <!-- GETS QUESTIONS FROM THE DATABASE -->

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.