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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:42:59+00:00 2026-05-28T14:42:59+00:00

I am trying to teach myself jquery, (not so successfully so far) why doesn’t

  • 0

I am trying to teach myself jquery, (not so successfully so far) why doesn’t the div with id fill get updated when i click submit?

<script type="text/javascript" src="jquery-1.7.1.min.js"></script>              
<script type="text/javascript">
  $(document).ready(function(){
    $("input#go").click(function(){
      $("div#fill").load('test1.txt');
    });
  });
</script>
</head>
<body>                            
  <form name="login"> 
    <label><strong>Administrative Login </strong></label>                              
    <p>Username:</p>                
    <input name="username" type="text" id="username" />            
    <p>Password</p>               
    <input name="password" type="password" id="password" />
    <br>                     
    <input type="Submit" id="go">
    <div id="fill"></div>
  • 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-28T14:43:00+00:00Added an answer on May 28, 2026 at 2:43 pm

    You need to cancel the default action of the submit button by returning false in the click handler:

    $(document).ready(function(){
        $("input#go").click(function() {
            $("div#fill").load('test1.txt');
            return false;
        });
    });
    

    By returning false, the form is not being submitted normally, the browser stays on the same page and the AJAX call that you are performing to fetch the text.txt file from your server has enough time to execute.

    As an alternative I would recommend you subscribing to the submit event of the form instead of the click event of the submit button:

    $(document).ready(function(){
        $("form").submit(function() {
            $("div#fill").load('test1.txt');
            return false;
        });
    });
    

    This will ensures that the AJAX call will be executed everytime the form is submitted, not only if the submit button is clicked. But of course that will depend on your requirements.

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

Sidebar

Related Questions

I am trying to teach myself jquery while reading someone else's code, and I
I'm trying to teach myself python using Google's AppEngine , and I can't get
I'm trying to teach myself Ruby's Treetop grammar generator. I am finding that not
I'm trying to teach myself Jquery effects to enliven my websites. I've created a
I'm trying to teach myself some basic jquery and am having trouble with an
I have been trying to teach myself Lambdaj and it doesn't seem to want
I'm basically trying to teach myself how to code and I want to follow
I am trying to teach myself MySQL/PHP from the very beginning. The following code
I'm trying to teach myself php... so please be kind and bear with me.
I'm trying to teach myself C++, and one of the traditional new language exercises

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.