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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:16:21+00:00 2026-06-15T20:16:21+00:00

I am new to AJAX/javascript and I am developingin jsp. I am trying to

  • 0

I am new to AJAX/javascript and I am developingin jsp.
I am trying to submit a text entered in a text area using a JavaScript button.
here is the relevant parts:
For the first submit button it worked fine but when posted I got a plain page instaed of keeping the content of EditText.jsp, I don’t know why?
The second button is what I am trying to do with replacing the getSomethingWithAjax method by my own method in order to enter a large number of characters.
It seems like POST won’t have a limitation in number of characters to be submited.

   function submitText()
   {
      var value =$("input[name=text]").val();
      jQuery.ajax({type:"POST",url:"EditText.jsp"})
   }
 </script>

 <form method="POST" class="example" action="/jsp/EditText.jsp" id=form2>
 <input type=hidden name=filepath value="<%=filename%>">
 <input type=hidden name=textarea value=true>

 <!--text area part here-->
 <!--first submit button-->
 <input type=submit name=submit value="Save Changes" onClick="if(runOnSubmit()) 

 {getSomethingWithAjax('EditText.jsp'+getAllFormElementsAndMakeIntoURI(true

 ),'','hereIsTheMainHeaderSpan',false,false);}">
 <!--the second button that I am trying to make-->
 <input type="button" name="submit" value="Save Changes" onClick="submitText()">

Please let me know of your suggestions.
if you wanna see the whole code click the link:
https://stackoverflow.com/questions/13828063/jsphow-to-replace-the-button-below-to-make-execute-the-request
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-06-15T20:16:22+00:00Added an answer on June 15, 2026 at 8:16 pm

    First of all, the way you’re trying to do that is horrendous.

    The point is that we don’t know what some of your functions are doing. But if it changes the signature of the servlet method you’re trying to post to, then you could get an empty response back.

    Just bind a function to the form’s submit event:

    <script type="text/javascript">
        $('#form2').submit(function(){
            $.ajax({
                "type": "POST",
                "url": "EditText.jsp",
                "data": $('#form2').serialize(),
                "success": function(){
                    //callback function
                }
            });
        }
    </script>
    
    <form method="POST" class="example" action="/jsp/EditText.jsp" id=form2>
        <input type=hidden name=filepath value="<%=filename%>"/>
        <input type=hidden name=textarea value=true />  
        <input type=submit name=submit value="Save Changes">
        <!--the second button that I am trying to make-->
        <input type="button" name="submit" value="Save Changes">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey there, new to AJAX, JS.. Im trying to add to a Javascript/Ajax search
I'm completely new to the javascript and ajax world but trying to learn. Right
I'm very new to the AJAX and Javascript world and I'm trying to implement
Yo. I'm really quite new to this whole JavaScript business, not to mention AJAX,
I am very new to ajax concept,I want to submit a form without refresh
I'm trying to figure out how to load a new image with ajax when
I am pretty new to ajax,jquery and javascript. So need help. I have a
I'm fairly new to using AJAX in ASP.NET (although I am very familiar with
Using Ajax.ActionLink's OnSuccess-Event brings me some trouble. As asked here the function cannot be
I am developing application using Ajax and jsp. My index.jsp page has HTML code

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.