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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:37:17+00:00 2026-05-23T17:37:17+00:00

I have a form as under <html xmlns=http://www.w3.org/1999/xhtml> <head runat=server> <title>Untitled Page</title> <script type=text/javascript

  • 0

I have a form as under

    <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>

    <script type="text/javascript" src="JQuery/jquery-1.6.1.min.js"></script>

    <script type="text/javascript">
        $(document).ready(function() {
        $("#btnSubmit").click(function() {
                $.ajax(
            {
                url: "Default2.aspx",
                data: "get=" + document.getElementById("TextBox1").value,
                success: function(data) {
                $('#lblServerResponse').html(data);
                },
                error: function() { alert(arguments[2]); }
            });

            });
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table>
            <tr>
                <td>
                    Enter your name:
                </td>
                <td>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </td>
                <td>
                    <asp:Button ID="btnSubmit" runat="server" Text="Click Me" />
                </td>
            </tr>
            <tr>
                <td>
                Server Response:
            </td>
            <td>           
                <span id="lblServerResponse"/>
            </td>
            </tr>

        </table>
    </div>
    </form>
</body>
</html>

After I enter some value in the textbox and click on the button, I am able to get the data but it is not retaining in the span.

What is the problem and how can I overcome this?

Thanks

  • 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-23T17:37:17+00:00Added an answer on May 23, 2026 at 5:37 pm

    If you can, use client-side elements instead:

    <form id="form1">
    <div>
        <input type="button" id="Button1" value="Button" />
        <input type="text" id="TextBox1" />
        <span id="Blah"></span>
        <!-- the hidden input may no longer be required -->
        <input type="hidden" id="Label1" />
    </div>
    </form>
    

    Then your javascript will be like:

        $(document).ready(function() {
            $("#Button1").click(function() {
              $.ajax(
              {
                url: "Default2.aspx",
                data: "get=" + $("#TextBox1").val(),
                success: function(data) {
                    $('#Blah').html(data);
                    $('#Label1').html(data); //the hidden input may no longer be required
                },
                error: function() { /* handle here */ }
              });
            });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a form with the php code right under the html form
I have some very simple HTML: <div id=advisor> <div id=print_this_container> <form> <input type=button value=
how to display error onto another page? I have a form under user folder
I have this in courses.html.erb under app/views/students <% if @student.courses.count < Course.count then%> <%
I have 2 HTML submission fields under one submit button, one of which is
I have a web page that dynamically generates form HTML via JavaScript and pours
Is it valid XHTML / good practice to have links of the following form?
I have an HTML form that previously was only used for text attributes for
I have an image upload form <% using (Html.BeginForm(PictureValidateAndSave, UserGallery, new {}, FormMethod.Post, new
I have two textboxes (part of a form), in the same line, and under

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.