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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:32:48+00:00 2026-06-18T04:32:48+00:00

The following jQuery function returns a correct JSON response from Spring. $(function() { $(‘#dataForm’).submit(function()

  • 0

The following jQuery function returns a correct JSON response from Spring.

$(function() {
    $('#dataForm').submit(function() {

        var rows;
        var form = $(this);
        rowCount(function() {
            var url = form.attr('action'),
            rows = form.find('input[name="rows"]').val();

            if(rows==0)
            {
                insert();
            }
            else if(rows==1)
            {
                update(function(response){
                    $("#textContents").val(response);
                    alert($("#textContents").val()); 
                    //Alerts the correct contents from the database
                });
            }
        });
        return false;
    });        
});

This function is called when the form is submitted.

The alert box in the else if condition alerts the correct contents from the server. textContents is a <span></span> id like.

<span id="textContents"></span>

Everything is fine but the response is apparently not being written to the HTML span tag for unknown reasons.

I have even removed design with all HTML templates of the current page but no clues found. If I changed the span tag to some other like <textarea></textarea> for demonstration, then the contents is displayed.

There are no misplaced tags on the form. I have also tried to replace <span> with <div> but it didn’t help either. What am I overlooking here? Obviously, something really very basic.

  • 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-18T04:32:48+00:00Added an answer on June 18, 2026 at 4:32 am

    You should use $("#textContents").html(response);

    Because <span> has no value.

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

Sidebar

Related Questions

I have the following jquery code: jQuery(function(){ jQuery(select#rooms).change(function(){ var options = ''; jQuery.getJSON(/admin/selection.php,{id: jQuery(this).val(),
I have the following jquery: $(.download).click(function(){ $.post('get_bot.php', url_code=+url_code, function (response) { alert(response); }); });
i have the following javascript file named coupon.js - jQuery(document).ready(function(){ jQuery('.appnitro').submit( function() { $.ajax({
I having trouble with the following two jquery scripts $(document).ready(function() { var $checkboxes =
Given the following jquery code.. jQuery.fn.sliding = function () { return this.each(function () {
The following JQuery function is not working entirely. IE 7 processes both alerts, but
I have the following jquery function that submits to an iframe. The message sent
In the following jquery function, can someone explain to me why second is being
I have the following jquery function for filtering the contents of a listbox on
I have the following jquery function > <script type=text/javascript> > > $(document).ready(function() { >

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.